Get the full URL for a page

Get the full URL for a page

am 02.01.2008 17:31:23 von John Smith

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.

Re: Get the full URL for a page

am 02.01.2008 17:39:37 von mark

"Waldy" wrote in message
news:eyyQrzVTIHA.1212@TK2MSFTNGP05.phx.gbl...

> 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


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Re: Get the full URL for a page

am 02.01.2008 18:03:08 von John Smith

Hi Mark,
thanks for that, but I need the path to another page, not the
current one.


"Mark Rae [MVP]" wrote in message
news:Ow$FD4VTIHA.1208@TK2MSFTNGP03.phx.gbl...
> "Waldy" wrote in message
> news:eyyQrzVTIHA.1212@TK2MSFTNGP05.phx.gbl...
>
>> 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
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net

Re: Get the full URL for a page

am 02.01.2008 18:50:55 von mark

"Waldy" wrote in message
news:%237vgbFWTIHA.4768@TK2MSFTNGP02.phx.gbl...

> 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;


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Re: Get the full URL for a page

am 07.01.2008 15:52:12 von John Smith

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";