ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 12th, 2004, 05:34 PM
mdriest mdriest is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 mdriest User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry ASP Login with Referrer???

Ok I have a basic login setup login.asp which redirects users to page.asp

In the page.asp file I have the following setup so that it will redirect users NOT logged in to the login page.

<%
if session("member")=session("") then
response.redirect "login.asp?return=" & _
request.servervariables("script_name") & "?" & _
server.urlencode(request.querystring)
end if
%>

Now at the login page it then looks like this:

login.asp?return=pageasp?del%3Dconfirm%26ID%3D34

Unfortunately all that formatting/encoding messes up my numbers and when the login is complete it only takes me to page.asp?del=confirm

when it really should be : page.asp?del=confirm&ID=34 -------- Why are the = signs getting written as %3D?

I tried removing the server.urlencode part so that it only showed as "request.querystring". When doing this everything displayed ok and the url looked like this: login.asp?return=page.asp?del=confirm&ID=34

However after the login I was still taken to page.asp?del=confirm

Any ideas would be appreciated, thanks.

Reply With Quote
  #2  
Old March 12th, 2004, 07:39 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
Where does the ID get added to the querystring? Using the code above, only the current script name is appended.

Also, what's the point of 'if session("member") = session("")'?? Just use the code 'if session("member") = ""'
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old March 13th, 2004, 10:25 AM
mdriest mdriest is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 mdriest User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
the ID gets added with the del=confirm&ID=11

Quote:

Also, what's the point of 'if session("member") = session("")'?? Just use the code 'if session("member") = ""'

I got that part off an asp site, I just copied their whole code for doing a redirect like that.

My original code used to be:

<%
ifsession("member")=session("") then
response.redirect "login.asp"
end if
%>

And it worked fine.

I'm wondering if somehow I can pass the return to url to the login.asp script without posting it like :
login.asp?return=page.asp?del=confirm&ID=34

Any ideas, examples are appreciated. Thanks.

Reply With Quote
  #4  
Old March 13th, 2004, 02:30 PM
mdriest mdriest is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 mdriest User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
For some reason it drops the &ID=41 and the error on the page is this:



Microsoft OLE DB Provider for ODBC Driverserror '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID='. /page.asp, line 462

Reply With Quote
  #5  
Old March 13th, 2004, 06:09 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
Show us the code that adds the ID to the querystring.
Use
Code:
if session("member") = ""
instead of what you have. It's inefficient to access system objects when you don't need to.

Reply With Quote
  #6  
Old March 13th, 2004, 07:39 PM
mdriest mdriest is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 mdriest User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<%
response.redirect "login.asp?return=" & _
request.servervariables("script_name") & "?" & _
request.querystring
end if
%>

This code snippet was found on a sample here on the DevArticles site.

The ' "?" & _ request.querystring' picks up the string from the requested page:

page.asp?del=confirm&ID=41

It then kicks me over to the login.asp page and looks like this:

login.asp?return=page.asp?del=confirm&ID=34

One the login is complete, unfortunately I am taken to:

page.asp?del=confirm

For some reason like I said, the ID is passed to the login script, and its supposed to redirect me to the full requested url.

Now the kicker is if I request a query like:

page.asp?section=print

It is then passed to : login.asp?return=page.asp?section=print

Once logged in everything is ok and I am taken to the requested page.

It just seems like its dropping the second part of the queries out.

Reply With Quote
  #7  
Old March 14th, 2004, 04:27 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
request.servervariables("SCRIPT_NAME") only gets the NAME of the script, not the query string values that follow.

Use request.servervariables("QUERY_STRING") to get the qry string values.

Before you go too much further, I'd recommend at least reading the ASP documentation, and a few beginner tutorials, before posting again.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > ASP Login with Referrer???


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT