Get Request.RawURL from Parent Page

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
 
S

Shan Plourde

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
 
D

Dale

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top