Hi,
How can I get the url of the active aspx page from the code behind so that I can assign it to a string variable?
Does it make a difference in what page-lifecycle stage I call this?
Thanks
Hi,
How can I get the url of the active aspx page from the code behind so that I can assign it to a string variable?
Does it make a difference in what page-lifecycle stage I call this?
Thanks
To Get the path
System.Web.HttpContext.Current.Request.Path
Or you can also do..
Request.Url.AbsoluteUri
And it does not matter in page life cycle.
if you're on a page:
Request.Url.ToString();
if you are a class library elsewhere
HttpContext.Current.Request.Url.ToString();
Doesn't matter about lifecycle