Name of previous page

D

David C

I want to know what the name of the previous page was in the Page_Load of
the opened page but I cannot find anything in the Page.PreviousPage
properties. How can I know the calling page from a Page_Load event?
Thanks.

David
 
H

HillBilly

We can get the previous page from the HTTP_REFERER Server Variable
too --BUT-- only if a click event was used to request the opened page.
 
D

David C

Mark Rae said:
Page.PreviousPage will only be populated if you're doing cross-page
posting:
http://msdn.microsoft.com/en-us/library/ms178139.aspx

Alternatively, you can look at the Request.UrlReferrer property:
http://www.google.co.uk/search?aq=1&oq=Request.Ur&sourceid=chrome&ie=UTF-8&q=request.urlreferrer

However, this cannot be relied on as it will not be available after a
Response.Redirect. Also, if this is a public website, you may find that
your ISP strips this name/value pair out of the Request headers for
(alleged) security reasons...
I am using javascript window.open() to open the page because I want to
control the width and height of the opened page. Does that help? Is there
another way I can do the same with HyperLink control? Thanks.

David
 
S

Scott M.

If, on the previous page itself, you create a public property that contains
the, at that point, current page's name, you can retreive that on the second
page that you crosspagepostback to by using the
Page.PreviousPage.propertyName syntax. You'll also need to use the
PreviousPageType directive on the second page for this to work.

-Scott
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top