You must Sign In to post a response.
  • Category: .NET

    Bundling in MVC for files on remote server

    Hi,

    I have my assets on remote server , on some other server than my application server.
    How Can i create the bundles for those files and can use in my MVC Application?
  • #767070
    What you mena by bundle ? do you want to ZIP or what ?
    you need to run some code on remote server to zip selected files and then you can download them on your server
    may be you can use Webclient class for it

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #767072
    It is nothing, To reduce the load of the browser we have to compress the resources and bundle it. You have to do two things to do this.
    1. Add the files which you want to bundle it in the App_Start/BundleConfig.cs
    Following is the sample code
     
    public static void RegisterBundles(BundleCollection bundles)
    {
    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
    "~/Scripts/jquery-{version}.js"));
    }

    2. Register the Bundle in the Global.ashx.cs

    protected void Application_Start()
    {
    BundleConfig.RegisterBundles(BundleTable.Bundles);
    }

    By Nathan
    Direction is important than speed

  • #767145
    Hi Nathan

    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
    "~/Scripts/jquery-{version}.js"));
    //this method takes the virtual path only, My JS files are placed on some server .
    example : www.abc.com/assests/JsFile.js

    I have to access this from remote server, I cannot download these assests on my local machine, because these are huge such JS and CSS Files.

    Thanks!
    Anjali Bansal

    ~Give your best and lead the world


  • Sign In to post your comments