How to redirect to the same page from where the update was requested?

I have this button on several pages of my web site:

<form method="POST" action="AccessLevel.asp"><input type="hidden" name="ID" value="<%=ID%>"><input type="hidden" name="AccessLevel" value="2" /><input type="Submit" value="Submit" /></form>

This is my AccessLevel.asp:

myId = Request.form("ID")

myAccessLevel = request.Form("AccessLevel")

StrSQL = "Update AdminData SET AccessLevel= '" & myAccessLevel & "' Where ID in ("&myId&")"

Conn.Execute StrSQL

'Redirect to the UPDATED page
Response.Redirect "index.asp"

What I would like is redirect the users to the same page from where the update is requested, i.e. to where the button was clicked, instead of index.asp

I would appreciat your help.
Who is Participating?
GaryConnect With a Mentor Commented:
So just change your redirect
Response.Redirect  (Request.ServerVariables ("HTTP_REFERER"))
Randy DownsOWNERCommented:
Why not just remove the redirect and you should still be on the updated page.
Response.Redirect to the referrer?
romsomAuthor Commented:
Gary - Yes, response.redirect to the referrer.

Number1 - I didn't know how to place the code on the same page
romsomAuthor Commented:
Thank you very much; I've learned something new.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.