• 0

ASP redirect to previous page


Question

Is it possible to utilize ASP's Response.Redirect command to return to the previously viewed page?

I have a member's sign in box on all of my front-end pages. If the authentication page fails to validate the user name and password I wish it to return to the page the user was last at. I have every page's sign in form's action referring to one validation page.

If this is possible, can someone paste the code for me?

Much thanks!

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Well, set the previous page to add a ?previouspage=blank.asp to the login page URL and access it using the Request object.

But the real question here is why are you using ASP when ASP .net 2.0 is FREE and there is a GOOD free IDE for it from Microsoft (Visual Web Developer Express @ msdn.microsoft.com).

Link to comment
Share on other sites

  • 0

Well, set the previous page to add a ?previouspage=blank.asp to the login page URL and access it using the Request object.

But the real question here is why are you using ASP when ASP .net 2.0 is FREE and there is a GOOD free IDE for it from Microsoft (Visual Web Developer Express @ msdn.microsoft.com).

Just do a Response.Redirect(Server.RequestVariables("HTTP_REFERER"))

Link to comment
Share on other sites

  • 0
But the real question here is why are you using ASP when ASP .net 2.0 is FREE

Because OP may have something in Classic and doesn't want / need to convert the lot? Just because it can be done doesn't mean it should be done.

MyServerGuy: would work nicely until someone blocks referrer (and it's Request.ServerVariables)...

As there is a form (posted I presume as it is a login form) add a hidden field with the value set to Request.ServerVariables("SCRIPT_NAME") so you don't use a hardcoded value and retrieve that

Link to comment
Share on other sites

  • 0

busted by mrbester :D it was a rush job in between errand runs. And you're right, it would... and referer is blocked quite a bit now, or not transferred at all (in the instance of HTTPS). You would be better off with a hidden form field that grabs the script name.

Link to comment
Share on other sites

  • 0

See my previous post and replace referrer with JavaScript.

You can't rely on the client whatsoever. You could have set up a JavaScript bounce with a meta refresh fallback and you'd still lose out (especially if they used HTTP_REFERER as the data). It's something you want the server to do, so let the server do it. At least you have control there.

Oh, and language="javascript" is so 1997. It's type="text/javascript" nowadays...

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.