Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2007, 05:55 PM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

thanks for the code,

this is what i get -

Error Type:
Microsoft VBScript compilation (0x800A03F6)
Expected 'End'
/abachi/login.asp, line 36

 
Old February 19th, 2007, 07:03 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Ummm? I just executed this code on my webserver and it worked fine. Are you using the code that is pasted above or the code that came to you in your email?

I edited the post due to a typo and that may be the problem your having.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
 
Old February 19th, 2007, 07:17 PM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

ok................

IT WORKS!!!!!

i cannot thank you enough for all your help and support. is it relatively easy to setup a dynamic redirect? i have specified a series of webpages in my table (different one for each login) and i would like to redirect to there.

Neil

:D :D :D :D

 
Old February 19th, 2007, 07:27 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

It depends you could use this statement
"SELECT * FROM tblusers WHERE username='"& UCase(username) & "' AND password='" & UCase(password) & "'"

as long as the the page you are redirecting to belongs to that table you could do something like:

Response.Redirect(rs("redirectPage"))

Else you will have to open another query like

SELECT link From <table> where Username ='" & username &"'"

I would highly suggest picking up a book and reading up on ASP as its nearly impossible to get this kind of response to threads all the time, reading will save you alot of headaches for sure.

Glad you got it working and good luck.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
 
Old February 19th, 2007, 07:29 PM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

hi,

my dad is looking into an asp bible in the morning!

i have been scouring the code as if i enter incorrect details then the page just goes blank. is this something to do with the else blankerror statement?

Neil

 
Old February 19th, 2007, 07:37 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

No, it has to do with my containing IF ELSE block. This is not the way you should implement this by any means, however, to get this working for you that is how i wrote it.

By design, if you enter a username and password the code enters the If protion of the statement so, even if the credentials are incorrect, the ELSE statement (the part that displays the form) will NEVER execute.

Alternatively you could adjust this so that the user sees the form again or that they get redirected to a page telling them they have supplied invalid credentials. That, however, I will leave up to you to tinker with ;]

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
 
Old February 19th, 2007, 07:40 PM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

i appreciate that, i'm gonna take a stab at using some of the code that is used for the correct login and redirect to the login page again and use a popup window using VB.

thank you once more for all your help, none of this would have been possible without your valuable knowledge and input.

Kind regards

neil

 
Old February 20th, 2007, 01:22 PM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

Hi, all good so far,

I created in my database a field with a link to another page on the website where (depending on the user logging in), it will be dynamic depending on the username and password.

using the code published on page 3, im guessing i need to add the following:

1. at the top in dim, add the field name (redirect)

2. underneath, write redirect=TRIM(Request("redirect"))

3. sql = "SELECT * FROM users WHERE username='"& UCase(username) & "' AND password='" & UCase(password) & "' AND redirect='" & UCase(redirect) & "'" ( i added selecting the redirect field into the sql)

4. this is where i get stuck - i have the Response.Redirect() and i am tempted to add the selected field into the brackets but i am not sure that this would work, i had a stab at it and inserted the code listed above into the rest of the ASP page and it still loaded and allowed the login but the redirect failed.

Any ideas?

Thanks

Neil

 
Old February 20th, 2007, 01:23 PM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

Quote:
quote:Originally posted by neil.abachi07
 Hi, all good so far,

I created in my database a field with a link to another page on the website where (depending on the user logging in), it will be dynamic and redirect to the correct page

using the code published on page 3, im guessing i needed to add the following:

1. at the top in dim, add the field name (redirect)

2. underneath, write redirect=TRIM(Request("redirect"))

3. sql = "SELECT * FROM users WHERE username='"& UCase(username) & "' AND password='" & UCase(password) & "' AND redirect='" & UCase(redirect) & "'" ( i added selecting the redirect field into the sql)

4. this is where i get stuck - i have the Response.Redirect() and i am tempted to add the selected field into the brackets but i am not sure that this would work, i had a stab at it and inserted the code listed above into the rest of the ASP page and it still loaded and allowed the login but the redirect failed.

Any ideas?

Thanks

Neil

 
Old February 20th, 2007, 02:38 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Is the path of the page you are redirecting to coming through a query string value or is it on the form somewhere? If it isnt, Request("redirect") does you no good.

Request is used to get values out of a query string or from fields on a form (Request.QueryString and Request.Form respsectively)

Since you said that the login determines the redirect
redirect='" & UCase(redirect) & "'"

Does you no good either as you are telling the SQL Statement: "Return me all rows where the username equals this, password equals this, and redirect equals this"

In theory, if you have a column in your Users table that tells you where the user needs to go (lets call it redirect) your select statement will return a row that containst that column based on this sql statement:

"SELECT * FROM users WHERE username='"& UCase(username) & "' AND password='" & UCase(password) & "'"

So you should be able to do this:

Response.redirect(rec("redirect"))

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic page creation DyerOppenheimer BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 June 29th, 2009 05:34 PM
delayed login account creation GameGorilla BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 January 22nd, 2008 11:27 PM
Creation of HTML page by C# Somesh C# 1 January 24th, 2007 03:21 PM
Newbie Help. Login to unique login page per user Kainan Classic ASP Professional 10 May 3rd, 2005 07:47 AM
username/password creation of login page in asp undercurrent Classic ASP Basics 3 March 21st, 2005 08:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.