Tuesday, November 19, 2013

How to set base URL in ASP.NET MVC for JavaScript?

In _Layout.cshtml, Add base tag in head, and pass base URL.

<head>
    <base href='@string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"))'/>
</head>