Get absolute path of a file :
Further reading:
http://www.west-wind.com/weblog/posts/2009/Dec/21/Making-Sense-of-ASPNET-Paths
string
absoluteFilePath = Server.MapPath("~/Products.xml");
Get Complete url of the current page:
string
completeUrl = HttpContext.Current.Request.Url.AbsoluteUri;
// "http://localhost:35876/Default.aspx"
Get the domain name (host header):
string domainName = HttpContext.Current.Request.Url.Host;
OR
OR
string domainName =HttpContext.Current.Request.Headers["Host"]
// "localhost"
Get Relative path of the current page (relative to the root) :
string relativePath = HttpContext.Current.Request.Url.AbsolutePath;
// "/Default.aspx"
http://www.west-wind.com/weblog/posts/2009/Dec/21/Making-Sense-of-ASPNET-Paths
Simple, concise list.
ReplyDeleteThanks for posting.