Ray's Asp.net Blog
Answers and code snippets from ASP.NET projects (Webforms/MVC/Classic ASP)
Pages
Event registration app with QR/Paypal
Home
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>
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment