Get the full URL for a page

  • Thread starter Thread starter Waldy
  • Start date Start date
W

Waldy

Hi there,
how do I get the full path for an .ASPX page? I thought the
ResolveURL would do it, but it only seems to return the page name with a
forward slash at the start. I need to send the full external path to remote
users so that they can run the page.
 
how do I get the full path for an .ASPX page? I thought the ResolveURL
would do it, but it only seems to return the page name with a forward
slash at the start. I need to send the full external path to remote users
so that they can run the page.

Request.Url.AbsoluteUri
 
thanks for that, but I need the path to another page, not the current one.

You should have said so...

string strRelativePath = "home/default.aspx"; // amend as necessary
Uri objUri = new Uri(Request.Url.GetLeftPart(UriPartial.Authority) + "/" +
Request.Url.Segments[1] + strRelativePath);
string strAbsoluteUri = objUri.AbsoluteUri;
 
Hi Mark,
thanks for that. I was hoping that there was a function for
it. I did this in the end as your code didn't work for me:

String FullURL = Request.Url.AbsoluteUri.Substring(1,
Request.Url.AbsoluteUri.Length - Request.Path.Length);
FullURL += "MyOtherPage.aspx";
 
Back
Top