Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP 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 March 1st, 2007, 10:11 AM
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

and the response.write i want in the body of the page to assess the value?

 
Old March 1st, 2007, 10:13 AM
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 doesn't matter where it goes. It will get wrote to the response stream none the less.

================================================== =========
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
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old March 1st, 2007, 10:26 AM
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 put auth - <%Response.Write(Session("Authenticated"))%> and after logging in and logging out the result was blank.

so if this is what is meant to happen then the problem comes after i load the home page (and then i go straight into the address bar and go to the protected page which i shouldnt be able to do.)

 
Old March 1st, 2007, 10:32 AM
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

I assume that your if statement on your protected page is something like this:

If Session("Authenticated") = "0" then
   response.redirect("home.asp")
Else
   'Access protected page
End if

Problem is (if i am correct in my assumption) you never test for a blank value, so yes you get access to the protected page because Authenticated does not == 0

================================================== =========
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
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old March 1st, 2007, 10:38 AM
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 see, my protection is pretty much the same except i have no else.

<%
If Session("Authenticated") = 0 Then
  Response.Redirect ("Login.html")
End If
%>

if it registering blank then is there a way around this? implement an elseif where if session("Authenticated") = "" then you get sent to the login page?

would "" signify blank or all values?

 
Old March 1st, 2007, 10:42 AM
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

that or my global.asa is not firing. on other pages, the code is highlighted colours depending on what you are saying except on global.asa, the code is not highlighted, almost like DW does not recognise the code.

i have created the code as i learnt and so i dont believe it to be wrong but i do not know

 
Old March 1st, 2007, 10:48 AM
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

Change your Logic:

If Session("Authenticated") <> "1" Then
  Response.Redirect ("Login.html")
End If

Then all values other then 1 cause the user to be sent to the login page.

Yes when you designate a string as stringValue = "" means it is a blank string, however, this is not to be confused with the absence of data or NULL. (As an FYI, vbscript does NOT understand the NULL keyword to specify a null object or string you have to set it to a value of Nothing.)

================================================== =========
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
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old March 1st, 2007, 10:57 AM
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 wish i said it worked, i really do. i have input the code as you put.
i really think now that the global.asa is not firing up - how would i know if it working?

 
Old March 1st, 2007, 11:05 AM
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

That doesn't make any sense. If the value is blank, that If statement should execute. Is your directory setup as an application directory on IIS?

Forget the logout page for a moment, when you login, do a response.write of the authenticated session value, does it, in fact, equal 1/

================================================== =========
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
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old March 1st, 2007, 11:10 AM
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

that does = 1!!

so how do i check that the directory is set as an app directory? i believe it is done but just in case.....






Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot log in brianrodda ASP.NET 2.0 Basics 1 July 15th, 2008 09:02 AM
How to log to server's event log LenexaKS Access VBA 4 March 11th, 2008 12:49 PM
Can't get Log to write the Log.txt file jnbutler BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 3 July 31st, 2007 04:04 AM
need log on help mohiddin52 Oracle 4 February 14th, 2005 02:20 PM
AppException Class -Log Error to Event Log bekim BOOK: ASP.NET Website Programming Problem-Design-Solution 7 December 7th, 2004 01:01 PM





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