Get Request.RawURL from Parent Page

  • Thread starter Thread starter Brent
  • Start date Start date
B

Brent

I've a menu created by a user control. The control is dropped onto every
page. In the user control, I'm trying to get the current page the user is
viewing -- that is, the name of the user control's PARENT page. I've tried
the following syntax:

Request.RawURL -- returns 0
Page.Request.RawUrl -- returns 0
HttpContext.Current.Request.RawURL -- returns 0

....so I think these are all the same request (for my purposes), just with
slightly different syntax.

How do I get at the parent page's info?

Thanks for any help.

--Brent
 
I generally use:
this.URL = Request.ServerVariables["URL"];
this.QueryString = Request.ServerVariables["QUERY_STRING"];

to retrieve and rewrite these or determine where the user is. The first
returns just the URL, the second the query string. You can parse URL to
determine what page the user is on quite easily.

You may also be able to use typeof(Control.Page) == <Your page
type)...not 100% sure though

Shan Plourde
 
It is my understanding that ServerVariables is only left in .NET for
compatibility reasons but that the recommended method is

Page.Request.Url.AbsoluteUri

Dale Preston
MCAD, MCSE, MCDBA



Shan Plourde said:
I generally use:
this.URL = Request.ServerVariables["URL"];
this.QueryString = Request.ServerVariables["QUERY_STRING"];

to retrieve and rewrite these or determine where the user is. The first
returns just the URL, the second the query string. You can parse URL to
determine what page the user is on quite easily.

You may also be able to use typeof(Control.Page) == <Your page
type)...not 100% sure though

Shan Plourde
I've a menu created by a user control. The control is dropped onto every
page. In the user control, I'm trying to get the current page the user is
viewing -- that is, the name of the user control's PARENT page. I've tried
the following syntax:

Request.RawURL -- returns 0
Page.Request.RawUrl -- returns 0
HttpContext.Current.Request.RawURL -- returns 0

...so I think these are all the same request (for my purposes), just with
slightly different syntax.

How do I get at the parent page's info?

Thanks for any help.

--Brent
 
Back
Top