Get URL of ASP.Net Page in code-behind

Viewed 359978

I have an ASP.Net page that will be hosted on a couple different servers, and I want to get the URL of the page (or even better: the site where the page is hosted) as a string for use in the code-behind. Any ideas?

10 Answers

Use this:

Request.Url.AbsoluteUri

That will get you the full path (including http://...)

Related