简体   繁体   中英

Button click to previous page asp.net

I am know some .Net basic but i need to do more advanced thing and I am stuck. I have empClientProfile.aspx page access to this page possible from different places (from list of clients, direct from menu and other.) I want to put button by pressing which it will redirect user on exact same page as he/she was before. For example if client doing select from agencies it should forward to exact same page with that select. If this page was accessed from main menu it should forward to home menu.

Using PostBackURL doesn't work here because as I said page can be reached from different pages.

Any Ideas how to do it?

Use the following button code in your HTML

<input type="button" value="Back" onclick="window.history.back()" />

UPDATE

Try these files and test it out...

filename: page1.htm

<html>
  <head>
    <title>page 1</title>
  </head>
  <body>
    PAGE 1<br />
    <a href="page2.htm">Jump to page 2</a><br />
    <a href="page3.htm">Jump to page 3</a><br />
  </body>
</html>

filename: page2.htm

<html>
  <head>
    <title>page 2</title>
  </head>
  <body>
    PAGE 2<br />
    <a href="page3.htm">Jump to page 3</a><br />
    <input type="button" value="Back" onclick="window.history.back()" />
  </body>
</html>

filename: page3.htm

<html>
  <head>
    <title>page 3</title>
  </head>
  <body>
    PAGE 3<br />
    <a href="page1.htm">Jump to page 1</a><br />
    <input type="button" value="Back" onclick="window.history.back()" />
  </body>
</html>

maybe u can use session to do it based on user action

switch(action)
{
case 1:
   postbackurl = Session[a].toString();
case 2:
   postbackurl = Session[b].toString();
default:
   break;

}

您是否尝试过Request.UrlReferrer?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM