473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

history -1

I need to make a response.redirect that will take the user back 2 pages
after they login.

How can i implement this into response.redirect ?

Thanks
May 19 '06 #1
12 2295
Jeff wrote:
I need to make a response.redirect that will take the user back 2
pages after they login.

How can i implement this into response.redirect ?

It can't be done without saving the pages in a hidden field. The server
knows nothing about the client history.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
May 19 '06 #2
So there is no way to have on the login page somewhere that says like

past = history.go(-2)

then have <% response.redirect "&past&"%>

or, could i have the login page, after a good login, go to a page that just
has the history.go(-3)


"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Jeff wrote:
I need to make a response.redirect that will take the user back 2
pages after they login.

How can i implement this into response.redirect ?

It can't be done without saving the pages in a hidden field. The server
knows nothing about the client history.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

May 19 '06 #3
Has to be a client side redirect
At the end of your routine create a javascript function to handle this
<%
If code works then
%>
<script>
{
window.history.go(-2);
}
</script>
<%
else
end if
%>

"Jeff" <gi*****@adelphia.net> wrote in message
news:S8******************************@adelphia.com ...
I need to make a response.redirect that will take the user back 2 pages
after they login.

How can i implement this into response.redirect ?

Thanks

May 19 '06 #4
Jeff wrote:
So there is no way to have on the login page somewhere that says like

past = history.go(-2)

If this is supposed to be server-side code, then no. The server knows
nothing about the client history.
See a client-side newsgroup such as m.p.scripting.jscript for help with
populating a hidden field on a form with the items in history (perhaps in an
xml string, but not required).

Server-side code can read the contents of the hidden field and do what needs
to be done.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
May 19 '06 #5
Jeff wrote:
So there is no way to have on the login page somewhere that says like

past = history.go(-2)

then have <% response.redirect "&past&"%>

or, could i have the login page, after a good login, go to a page
that just has the history.go(-3)


I take it back. There is a way to do it in server-side code: write a
client-side script block to the Response. Air code:

<%
If successfulLogin then
response.write "<script type=""text/javascript"">
response.write "history.go(-2);</script>
end if
%>

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
May 19 '06 #6
Thanks bob. This is working.. sortof. Here is the delema.

I have a report page with this at the top

if session("loggedin")<>1 then response.redirect "login.asp"

the login script sets the session to 1 if they are logged in, and lets them
view this page. if it isn't 1, then it sends them to the login page.

the problem is this, when it goes back 2 in history, it skips over that
report page, and goes to the page that I clicked report on. if i set it
to -1, it goes back to the login page. so it is missing the page that
redirected it to begin with.

am i doing something wrong?

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Jeff wrote:
So there is no way to have on the login page somewhere that says like

past = history.go(-2)

then have <% response.redirect "&past&"%>

or, could i have the login page, after a good login, go to a page
that just has the history.go(-3)


I take it back. There is a way to do it in server-side code: write a
client-side script block to the Response. Air code:

<%
If successfulLogin then
response.write "<script type=""text/javascript"">
response.write "history.go(-2);</script>
end if
%>

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

May 19 '06 #7
If Session("loggedin")<>1 Then
Session("redirect") = Request.ServerVariables("SCRIPT_NAME")
Response.Redirect "login.asp"
End If

Then in the login page, on successful log in:

If Session("redirect")<>"" Then
redirectpage = Session("redirect")
Session("redirect")=""
Response.Redirect redirectpage
End If

--
Mike Brind

Jeff wrote:
Thanks bob. This is working.. sortof. Here is the delema.

I have a report page with this at the top

if session("loggedin")<>1 then response.redirect "login.asp"

the login script sets the session to 1 if they are logged in, and lets them
view this page. if it isn't 1, then it sends them to the login page.

the problem is this, when it goes back 2 in history, it skips over that
report page, and goes to the page that I clicked report on. if i set it
to -1, it goes back to the login page. so it is missing the page that
redirected it to begin with.

am i doing something wrong?

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Jeff wrote:
So there is no way to have on the login page somewhere that says like

past = history.go(-2)

then have <% response.redirect "&past&"%>

or, could i have the login page, after a good login, go to a page
that just has the history.go(-3)


I take it back. There is a way to do it in server-side code: write a
client-side script block to the Response. Air code:

<%
If successfulLogin then
response.write "<script type=""text/javascript"">
response.write "history.go(-2);</script>
end if
%>

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


May 19 '06 #8
Jeff wrote:
Thanks bob. This is working.. sortof. Here is the delema.

I have a report page with this at the top

if session("loggedin")<>1 then response.redirect "login.asp"

the login script sets the session to 1 if they are logged in, and
lets them view this page. if it isn't 1, then it sends them to the
login page.
the problem is this, when it goes back 2 in history, it skips over
that report page, and goes to the page that I clicked report on. if i
set it to -1, it goes back to the login page. so it is missing the page
that
redirected it to begin with.

am i doing something wrong?

No, that's the problem with using History, which can cause pages to be
retrieved from the browser cacne rather than being re-requested from the
server.

You need to rethink what you are doing. At the very least, store the name of
the page you need to go back to in a session variable. Consider using
Server.Transfer instead of Response.Redirect to prevent pages from being
retrieved from the browser cache.

if session("loggedin")<>1 then
session("PageWhereAuthFailed") = "me.asp"
response.redirect "login.asp"
end if

in login.asp:
if SuccessfulLogin then
session("loggedin")=1
pageForm = session("PageWhereAuthFailed")
session("PageWhereAuthFailed") = ""
if len(pageFrom)>0 then
Server.Transfer(pageFrom)
else
'do the default action
end if
end if

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
May 19 '06 #9
Jeff wrote on 19 mei 2006 in microsoft.public.inetserver.asp.general:
hanks bob. This is working.. sortof. Here is the delema.

I have a report page with this at the top

if session("loggedin")<>1 then response.redirect "login.asp"

the login script sets the session to 1 if they are logged in, and lets
them view this page. if it isn't 1, then it sends them to the login
page.

the problem is this, when it goes back 2 in history, it skips over
that report page, and goes to the page that I clicked report on. if i
set it to -1, it goes back to the login page. so it is missing the
page that redirected it to begin with.

am i doing something wrong?


I prefer serverside session memory over clienside history:

if session("loggedin") <> 1 then
session("origin") = request.servervariables("URL")
response.redirect "login.asp"
end if

And a successful login will do:

response.redirect session("origin")

===========

Another way is to build the login code
as an include to every page top:
========= login.include.asp =============
<%
if request.form("password") <> "" then
do your autentication things
and set session("loggedin") to 1 if ok.
end if

if session("loggedin") <> 1 then
%>
<html>
<form method=post>
do the login html form things
....
</html>
<%
response.end
end if
%>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
May 19 '06 #10
I tried both of your ways, and they both work perfectly.
I prefer Mike's way, simply because I wouldn't have to change the
session("PageWhereAuthFailed") on each page that is protected.

You guys are truley the best at what you do, and you help and advice is
always appreciated.

Thanks
Jeff
"Jeff" <gi*****@adelphia.net> wrote in message
news:Zt******************************@adelphia.com ...
Thanks bob. This is working.. sortof. Here is the delema.

I have a report page with this at the top

if session("loggedin")<>1 then response.redirect "login.asp"

the login script sets the session to 1 if they are logged in, and lets
them view this page. if it isn't 1, then it sends them to the login page.

the problem is this, when it goes back 2 in history, it skips over that
report page, and goes to the page that I clicked report on. if i set it
to -1, it goes back to the login page. so it is missing the page that
redirected it to begin with.

am i doing something wrong?

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Jeff wrote:
So there is no way to have on the login page somewhere that says like

past = history.go(-2)

then have <% response.redirect "&past&"%>

or, could i have the login page, after a good login, go to a page
that just has the history.go(-3)


I take it back. There is a way to do it in server-side code: write a
client-side script block to the Response. Air code:

<%
If successfulLogin then
response.write "<script type=""text/javascript"">
response.write "history.go(-2);</script>
end if
%>

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


May 19 '06 #11
Jeff wrote:
I tried both of your ways, and they both work perfectly.
I prefer Mike's way, simply because I wouldn't have to
change the session("PageWhereAuthFailed") on each page
that is protected.


That technique should work fine unless/until you extend your login to span
multiple applications, technologies, servers or domains.

We built an enterprise-wide session architecture that allows ASP, JSP and
ASP.NET to share sessions (authentication as well as variables). We
authenticate under SSL against an NDS tree[1], and the individual
applications are a mix of SSL and non-SSL, depending on their sensitivity.
As you can imagine, this means the session information is kept in a
database, rather than on the web servers.

The ASP implementation is unsurprisingly the least elegant of the bunch, as
well as the most perturbable. We have distilled it to a Server.Execute()
call for each protected page. If/when you extend your login and can't figure
out how to proceed, post back here and I can probably offer some suggestions
based on lessons learned.

[1] This could just as easily be against AD.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
May 19 '06 #12
I will do that. Thanks so much for the help.
Jeff
"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:ee**************@TK2MSFTNGP03.phx.gbl...
Jeff wrote:
I tried both of your ways, and they both work perfectly.
I prefer Mike's way, simply because I wouldn't have to
change the session("PageWhereAuthFailed") on each page
that is protected.


That technique should work fine unless/until you extend your login to span
multiple applications, technologies, servers or domains.

We built an enterprise-wide session architecture that allows ASP, JSP and
ASP.NET to share sessions (authentication as well as variables). We
authenticate under SSL against an NDS tree[1], and the individual
applications are a mix of SSL and non-SSL, depending on their sensitivity.
As you can imagine, this means the session information is kept in a
database, rather than on the web servers.

The ASP implementation is unsurprisingly the least elegant of the bunch,
as well as the most perturbable. We have distilled it to a
Server.Execute() call for each protected page. If/when you extend your
login and can't figure out how to proceed, post back here and I can
probably offer some suggestions based on lessons learned.

[1] This could just as easily be against AD.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.
Use of this email address implies consent to these terms.

May 20 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Ashot | last post by:
This is sort of both Python and Vim related (which is why I've posted to both newsgroups). Python related: ---------------------- I have been frustrated for quite some time with a lack of a...
12
by: |-|erc | last post by:
when a user clicks back to get to my site, I want it to run a javascript function. can you detect when the FORWARD button is greyed out? Herc -- I call3d this fugly and I'm proud...
10
by: pmelanso | last post by:
Hello, How can I tell if there is a page to go back to in the history or not??? Same with forward??? say something like/// if (there is a page to go back to ) { // DO something }else { }
3
by: Phil Sherman | last post by:
UDB LUW (Windows) 8.1 FP9a I issued a PRUNE HISTORY 20050819 AND DELETE and was surprised to see that the archived log files were not physically deleted. The history record of the 20050818...
20
by: Dan | last post by:
Is there a way to obtain the last page visited? I don't want to go to that page, I just want to be able find out what page they came from, the url of that page. Is this possible?
3
by: pentisia | last post by:
Hi there, We are using history.go(integer) to go back to the certain page directly. Because there are some pages interaction in between. For example, starting from page 1 to page 2. From page...
3
by: Niall | last post by:
When I say 'last', I mean (eg.) the 100th item in a 100-item history list, *not* the immediately previous one! The problem is, the history.go() method only allows *relative* movement through...
10
Ajm113
by: Ajm113 | last post by:
Making a History Page for BIG Sites Intro: Ok, let's say after a while your website has grown massive. We're talking search engine, forum and video hosting -- you've got a LOT of content. And you...
0
by: lemnitzer | last post by:
Full Article: http://iamthewitness.com/FreedmanFactsAreFacts.html <-------- KEY DOCUMENT Steamy Excerpts: Will you be patient with me while I review here as briefly as I can the history of...
2
by: Max | last post by:
I recently moved to ASPnet Ext 3.5 What I can't get with Ajax and History browser managemet is this: User fills some fields (dropdown and textbox) on page 1 (all are in an update panel) User...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.