How do i redirect a user to the previous page they came from after logging in? HTML/ASP

StackOverflow https://stackoverflow.com/questions/22842545

  •  27-06-2023
  •  | 
  •  

Frage

Hi i need to redirect my users to the same page they were just on after logging into my site, the redirectory code will obviously be a different page depending on the page tehy were last at, any help would be appreciate :)

War es hilfreich?

Lösung

  1. Put an identifier for the page they are coming from in a hidden input in the form.
  2. Copy it to the form you show on a "Login failed, try again" situation (if there is a failed login, otherwise go directly to 3).
  3. Use that identifier to determine the URL to redirect to with a Location: header after a successful login
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top