[thelist] ASP/posting back to same page

aardvark roselli at earthlink.net
Tue Sep 19 17:11:34 CDT 2000


> From: "Jenn Coker" <me at wt.net>
> 
> can anyone tell me offhand what the standard format in asp is for
> refreshing back to the page a user was on when they login? 
> (action=""?)

what kind of refresh?  you can do a server-side redirect with  <% 
response.redirect "foo.asp" %>, there's also the new Transfer 
thingie (method?) for IIS5...

> i have a login.asp module in every page so i'm wanting them to go back
> to whatever page they were in when they decided to login (at this
> point, i like the idea of "login stupid" on the front page but i bet
> that's all wrong so;).. blah blah..

oh... i see... get the value of the current script name that has the 
login link:

<% ScriptName = Request.ServerVariables("SCRIPT_NAME") %>

make sure you put this at the top of every page, probably using an 
include (http://evolt.org/index.cfm?menu=8&cid=1344 - Including 
Files in ASP).... insert the value into a hidden form field like:

<input type="hidden" name="goSomewhere" value="<% = 
ScriptName %>">

then after a successful login, try a response.redirect, although 
there are better ways to do it since this function sends an Object 
Moved message which some browsers funk up on (like some 
installs of IE, which gives you a link to the new page)...

or tell the user the login is successful, and then populate a link to 
let the user manually take his/herself back... i hate not getting a 
confirmation of my login, but that depends on the use...

so (pseudo-code):

IF Login = "Yep" THEN
	response.redirect ScriptName
ELSE
	'show error and login page again
END IF

or...

IF Login = "Yep" THEN
	response.write "<a href=""<% = ScriptName %>"">Yep</a>"
ELSE
	'show error and login page again
END IF




More information about the thelist mailing list