Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Code to return to calling page (http://www.velocityreviews.com/forums/t797786-code-to-return-to-calling-page.html)

qaz 01-30-2005 12:37 AM

Code to return to calling page
 
I have login links on a number of pages in my site. Some of the pages
expect variables on the querystring.

I want to be able to login from any of these pages. The login link
redirects me to a login page. I want to go back to the page I came from and
preserve the variables on the querystring.

Can anyone give me a short script to have a user return to a calling page
that preserves the querystring?

For what it is worth, I has used a simple response.redirect
request.servervariables("script_name") until I realized that I was losing
the querystring.

I also tried this, but it did not work - (it kept posting me to the login
page regardless of where I came from)

dim sQS
sQS = request.querystring

.... [code here ] ...

response.redirect request.servervariables("script_name") & sQS

Any help is appreciated.



Evertjan. 01-30-2005 10:17 AM

Re: Code to return to calling page
 
qaz wrote on 30 jan 2005 in microsoft.public.inetserver.asp.general:
> dim sQS
> sQS = request.querystring
>
> ... [code here ] ...
>
> response.redirect request.servervariables("script_name") & sQS


You forget to insert the questionmark:

sQS = request.querystring
sSn = request.servervariables("url")
response.redirect sSn & "?" & sQS

=======================

A solution seems(!) to me to include on top of
every restricted page a "lockInclude.asp" include, that:

1 checks for the session variable "loggedinAs" not being empty,

2 if empty, displays a login form [followed by response.end],
submitting to the page, not just the include of course, itself.

The "lockInclude.asp" pseudocode, just the idea:

<%
if session("loggedinAs")<>"" then
' do nothing and go on with the calling page
' or perhaps do some householding tasks
elseif request.form("loginname")<>"" then
' Check the name/password for validity
' fill session("loggedinAs") only if check=ok
sQS = request.querystring
sSn = request.servervariables("url")
response.redirect sSn & "?" & sQS
else
%><html>..<form><input... <% ' ask for name/password
' build like a completely seperate login.asp, but is not
response.end
end if
%>

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


qaz 01-30-2005 02:42 PM

Re: Code to return to calling page
 
Thanks, Evertjan. Yes, I was forgetting the "?". It's strange how you can
look at something so much that you don't notice the obvious!!

Good idea on the lockInclude.asp. I think I will try it.

Thank you very much.

"Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
news:Xns95EE72D9D3E80eejj99@194.109.133.29...
> qaz wrote on 30 jan 2005 in microsoft.public.inetserver.asp.general:
> > dim sQS
> > sQS = request.querystring
> >
> > ... [code here ] ...
> >
> > response.redirect request.servervariables("script_name") & sQS

>
> You forget to insert the questionmark:
>
> sQS = request.querystring
> sSn = request.servervariables("url")
> response.redirect sSn & "?" & sQS
>
> =======================
>
> A solution seems(!) to me to include on top of
> every restricted page a "lockInclude.asp" include, that:
>
> 1 checks for the session variable "loggedinAs" not being empty,
>
> 2 if empty, displays a login form [followed by response.end],
> submitting to the page, not just the include of course, itself.
>
> The "lockInclude.asp" pseudocode, just the idea:
>
> <%
> if session("loggedinAs")<>"" then
> ' do nothing and go on with the calling page
> ' or perhaps do some householding tasks
> elseif request.form("loginname")<>"" then
> ' Check the name/password for validity
> ' fill session("loggedinAs") only if check=ok
> sQS = request.querystring
> sSn = request.servervariables("url")
> response.redirect sSn & "?" & sQS
> else
> %><html>..<form><input... <% ' ask for name/password
> ' build like a completely seperate login.asp, but is not
> response.end
> end if
> %>
>
> --
> Evertjan.
> The Netherlands.
> (Replace all crosses with dots in my emailaddress)
>





All times are GMT. The time now is 10:09 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.