By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,905 Members | 2,083 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,905 IT Pros & Developers. It's quick & easy.

How To Know Previous Page

P: n/a
Suppose I have three pages A.aspx, B.aspx, and C.aspx.

A and B each have a hyperlink that opens C. The hyperlink is identical on A
and B, and has no querystring parameters.

The user opens A.

The user then clicks the link to open C.

When C is opened, how can it "know" it was opened from A and not B? I need
for logic in page C's code-behind/Page_load() event to take different action
based on which page C was opened from (A or B or any other page in the
application.

Please note that I cannot hard-code or even table-drive a querystring
parameter into the hyperlink on each page that would provide this
information.

Thanks!
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
you can get the the previous page's url from 'Request.UrlReferrer'

HTH
"Wang" <sy*********@nospam.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
Suppose I have three pages A.aspx, B.aspx, and C.aspx.

A and B each have a hyperlink that opens C. The hyperlink is identical on A and B, and has no querystring parameters.

The user opens A.

The user then clicks the link to open C.

When C is opened, how can it "know" it was opened from A and not B? I need for logic in page C's code-behind/Page_load() event to take different action based on which page C was opened from (A or B or any other page in the
application.

Please note that I cannot hard-code or even table-drive a querystring
parameter into the hyperlink on each page that would provide this
information.

Thanks!

Nov 18 '05 #2

P: n/a
Any other ideas?
I already tried that: it appears that 'Request.UrlReferrer' is available
only on postbacks. At least I found it to be null during page_load(), while
it was there on postbacks (which is useless because during a postback you
already know the requesting page because the page is being requested by
itself - so to speak). Or am I missing something?

"Gibs" <do*********@yahoo.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
you can get the the previous page's url from 'Request.UrlReferrer'

HTH
"Wang" <sy*********@nospam.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
Suppose I have three pages A.aspx, B.aspx, and C.aspx.

A and B each have a hyperlink that opens C. The hyperlink is identical
on A
and B, and has no querystring parameters.

The user opens A.

The user then clicks the link to open C.

When C is opened, how can it "know" it was opened from A and not B? I

need
for logic in page C's code-behind/Page_load() event to take different

action
based on which page C was opened from (A or B or any other page in the
application.

Please note that I cannot hard-code or even table-drive a querystring
parameter into the hyperlink on each page that would provide this
information.

Thanks!


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.