Last post Jul 21, 2009 06:46 AM by Augi
Jul 21, 2009 05:28 AM|bec.username|LINK
A simple question for you guys but I just cant figure it out today.
How can I get the root path for the application from a view with current path looking like this?
I tried HttpContext.Current.Server.MapPath("~") but that gives the physical path.
Jul 21, 2009 06:44 AM|bec.username|LINK
Got it. HttpContext.Current.Request.ApplicationPath is what I needed.
Jul 21, 2009 06:46 AM|Augi|LINK
You can use Url.Content("~/Controller/Action/arg1/arg2/arg3") in Controller and View. Or you could use
System.Web.VirtualPathUtility.ToAbsolute method directly...