code_junkie

In ASP.NET MVC how can use I Url.Content() from code?

Nov 12th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. VirtualPathUtility.ToAbsolute("~/url/");
  2.  
  3. public static string CustomImage(this HtmlHelper html)
  4. {
  5. var Url = new UrlHelper(html.ViewContext.RequestContext);
  6. }
  7.  
  8. public static string MyHelper(this HtmlHelper h)
  9. {
  10. string url = h.ViewContext.HttpContext.Request.Url.AbsoluteUri;
  11. }
  12.  
  13. string relativePath =
  14. VirtualPathUtility.MakeRelative(Request.RawUrl, "~/myFolder/myImage.png");
  15.  
  16. string fullUrl = HttpContext.Current.Request.Url.AbsoluteUri;
Add Comment
Please, Sign In to add comment