Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
Dear All,

I have a image button on master page which postbacks user to another page and i want to get the name of the page from which it was actually clicked!!!
Plz. help.......

Thanks in advance!!!!!!
Posted

PreviousPage only works after a cross page postback. Beyond that, ASP.NET can't know what the last page was, how could it ? Do you understand how ASP.NET and the internet works ? They are stateless. Each request is unique and not part of a chain. You can CREATE a chain, by storing the name of the last page in the session, and checking it before you store it again ( check in events and page load, store in page prerender is a good pattern ). But, ask yourself first why you need to know, is there something wrong with your design as a whole ?
 
Share this answer
 
Comments
Supriya Srivastav 1-Jul-11 4:30am    
Actually i want to check whether the control is just passed from login page or from some another because if it's postbacked from login then it has to be redirected to specific page and if redirected from other pages then it has to be redirected to some other.
is it possible to check it without checking the session value specifically!!!
Thnks 4r ur sol.........
Christian Graus 1-Jul-11 4:37am    
OK, the way to do that is, your login page should be redirected to when someone is not logged in, with a query string value, such as login.aspx?redir=myotherpage.aspx. It doesn't matter what you call it, but use the query string to tell the login page where it should redirect to. In general when you move from one page to another and want to tell the new page to do something different, use the query string.
Supriya Srivastav 1-Jul-11 5:02am    
Thanks a lot.......
 
Share this answer
 
v2
Comments
Supriya Srivastav 1-Jul-11 4:13am    
Ya i tried it but it's value is getting null.
Prerak Patel 1-Jul-11 4:23am    
check this link, if it helps
http://blogs.mgtechgroup.com/markc/archive/2007/05/03/Using-PreviousPage-with-Master-Pages.aspx
Supriya Srivastav 1-Jul-11 5:01am    
Thanks.........
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900