Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
- <link href="Content/Site.css" rel="stylesheet" type="text/css" />
- <script src="../../Content/menu.js" type="text/javascript"></script>
- <script src="<%= ResolveClientUrl("~/Content/menu.js") %>" type="text/javascript"></script>
- public static string ResolveUrl(this HtmlHelper helper, string virtualUrl)
- {
- HttpContextBase ctx = helper.ViewContext.HttpContext;
- string result = virtualUrl;
- if (virtualUrl.StartsWith("~/"))
- {
- virtualUrl = virtualUrl.Remove(0, 2);
- //get the site root
- string siteRoot = ctx.Request.ApplicationPath;
- if (!siteRoot.EndsWith("/"))
- siteRoot += "/";
- result = siteRoot + virtualUrl;
- }
- return result;
- }
- <script type="text/javascript" src="<%= Html.ResolveUrl("~/Content/menu.js")%>"></script>
- <link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
Add Comment
Please, Sign In to add comment