Hi there,
been playing around with ResolveClientUrl("~/Confirmation.aspx") and other methods..
I am tryin go get the FULL absolute URL of the page including Http: etc etc..
Anyone knows how to do this?
thanks
Hi there,
been playing around with ResolveClientUrl("~/Confirmation.aspx") and other methods..
I am tryin go get the FULL absolute URL of the page including Http: etc etc..
Anyone knows how to do this?
thanks
Request.Url.ToString()
gets the absolute URL for the current request.
If you want to get it for a relative path:
Request.Url.GetLeftPart(UriPartial.Authority)
+ VirtualPathUtility.ToAbsolute(relativePath)
This will get you the url up to the root of the asp.net application (including virtual folders in IIS). From there you can just append the relative path of the file you want to reference
string url = HttpContext.Current.Request.Url.AbsoluteUri.Replace(
HttpContext.Current.Request.Url.AbsolutePath, string.Empty) +
HttpContext.Current.Request.ApplicationPath;
if (!url.EndsWith("/")) url += "/";
url += "path/to/myfile.jpeg";