Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Sorry, I left the last part of the code for Logon2.asp out. Below contains everything.


Message #1 by "Larry Rosenzweig" <rosenzl@o...> on Tue, 20 Nov 2001 23:04:47
This is now complete.



I just learned how to use the Session Objects. I used the "Site Security 

Sample: Design Documentation." It uses the Session_OnStart event. I got it 

to work fine. Then I started a new application in which I copied all my 

pages and includes, and the database, from my existing application(not the 

Site Securit Sample). I made changes to various pages so it would conform 

to the sample application above. My problem follows;



My first page is a Logon page(UserID and Password), called Logon2.asp. It 

has a Form action = Default.asp. After entering the user id and password, 

I get the following error;



"An exception of type "Runtime Error was not handled. Would you like to 

debug the application?". When I respond with "Yes", Interdev points to the 

following line in Global.asa.   Session.Timeout = 10



Please see the code for Logon2.asp and Global.asa below. I believe it has 

something to do with opening the recordset, but can't prove it. 



Thank you very much for any help with this.



Larry 



___________________________________________________________________________

Logon2.asp





<%@LANGUAGE="VBScript" ENABLESESSIONSTATE=false%>



<%'ENABLESESSIONSTATE=True Needed so Form elements 

'will be passed the first time (bug???)%>



<%Option Explicit%>



<%Response.Expires = -1%>



<%Response.Buffer = True%>



<!--#Include File="config.inc"-->



<html>

<head>

<title>Administrative Server Logon</title>

</head>



<!--#Include File="comtop.inc"-->



<table ALIGN="CENTER" CELLPADDING="8" CELLSPACING="0" BORDER="0">

<tr><td CLASS="clsTop" COLSPAN="2">

<b>Welcome to the Reservation system </b>

</td></tr>



<tr><td CLASS="clsTD2" COLSPAN="2">

<img SRC="images/key.gif" BORDER="0" WIDTH="22" HEIGHT="10">&nbsp;

Please Logon to the Schedule

<br>

<form ACTION="default.asp" METHOD="post" NAME="frmLogon">   

<tr>

<td CLASS="clsTD" ALIGN="CENTER">

    &nbsp;

    <p>User ID:</p>

    <p>Password:&nbsp;</p>

    <p>&nbsp;</p>

</td>

<td CLASS="clsTD2">	

	<input NAME="txtuserid" CLASS="Text" SIZE="20">  

    <p>	

	<input TYPE="password" NAME="txtpassword" CLASS="clsInput2" 

SIZE="20">

    </p>

</td>

</tr>

<tr><td CLASS="clsBottom" COLSPAN="2" ALIGN="CENTER"><br>

	<input TYPE="SUBMIT" VALUE="Submit" CLASS="clsInput" 

NAME="btnSubmit" ONMOUSEOVER="buttonchange('1')" ONMOUSEOUT="buttonchange

('0')">

	 

</td></tr>



</form>

</table>



      

<!--#Include File="combot.inc"-->

___________________________________________________________________________

Global.asa



  

<form ACTION="default.asp" METHOD="post" NAME="frmLogon">   

<tr>

<td CLASS="clsTD" ALIGN="CENTER">

    &nbsp;

    <p>User ID:</p>

    <p>Password:&nbsp;</p>

    <p>&nbsp;</p>

</td>

<td CLASS="clsTD2">	

	<input NAME="txtuserid" CLASS="Text" SIZE="20">  

    <p>	

	<input TYPE="password" NAME="txtpassword" CLASS="clsInput2" 

SIZE="20">

    </p>

</td>

</tr>

<tr><td CLASS="clsBottom" COLSPAN="2" ALIGN="CENTER"><br>

	<input TYPE="SUBMIT" VALUE="Submit" CLASS="clsInput" 

NAME="btnSubmit" ONMOUSEOVER="buttonchange('1')" ONMOUSEOUT="buttonchange

('0')">

	 

</td></tr>



</form>

</table>



      

<!--#Include File="combot.inc"-->



 



<SCRIPT LANGUAGE=VBScript RUNAT=Server>



'You can add special event handlers in this file that will get run 

automatically when

'special Active Server Pages events occur. To create these handlers, just 

create a

'subroutine with a name from the list below that corresponds to the event 

you want to

'use. For example, to create an event handler for Session_OnStart, you 

would put the

'following code into this file (without the comments):



'Sub Session_OnStart

'**Put your code here **

'End Sub



'EventName              Description

'Session_OnStart        Runs the first time a user runs any page in your 

application

'Session_OnEnd          Runs when a user's session times out or quits your 

application

'Application_OnStart    Runs once when the first page of your application 

is run for the first time by any user

'Application_OnEnd      Runs once when the web server shuts down



</SCRIPT>





<SCRIPT LANGUAGE=VBScript RUNAT=Server>



' try to validate the user, see comments in pgAccountAccess.htm

Sub Session_OnStart

	Dim cn				' ado connection object

	Dim rs				' ado recordset object

	Dim strSQL			' sql query string

	Dim struserid	' name of user(from logon2.asp)

	Dim strPassword		' password (from logon2.asp)



	' set session timeout to 10 minutes

	Session.Timeout = 10



	' get the login info the user entered in logon2.asp

	struserid = Request.Form("txtuserid")

	strPassword = Request.Form("txtPassword")



	' make sure they did not leave the fields blank

	If struserid = "" And strPassword = "" Then

		' no login information at all, abandon the 

		' session and send to the login page

		Session.Abandon

		Response.Write "session abandoned"

		Response.Redirect "logon2.asp"

	Else

		' see if user entered valid login information

		

		' first, create the connection and recordset

		Set cn = Server.CreateObject("ADODB.Connection")

		Set rs = Server.CreateObject("ADODB.Recordset")

	

		' build the query string using info collected from the

		' login page (pgAccountAccess.htm)

		strSQL = "SELECT userid, logon FROM tbllogons WHERE " & _

			"(UserID = '" & struserid & "') AND " & _

			"(Logon = '" & strPassword & "')"

	

		' Open the connection, the connection string, username and 

password

		' are stored in the Application object which was created 

by the 

		' Data Environment connection wizard

		cn.Open Application("maxxschedule_ConnectionString"), _

			Application("maxxschedule_RuntimeUserName"), _

			Application("maxxschedule_RuntimePassword")

			

		' open the recordset

		rs.Open strSQL, cn



		' see if found a recordset, if we did, the user entered

		' valid information in the login page

		If Not rs.EOF Then

			' login successful

			' save variables that can be accessed by other 

pages

			Session("Logon") = rs("Logon")

			Session("UserID") = rs("UserID")



			' clean up the ado objects

			Set cn = Nothing

			Set rs = Nothing	

	

			' display the success page

			Response.Redirect "default.asp"

		Else

			' login failed

			' clean up the ado objects

			Set cn = Nothing

			Set rs = Nothing	



			' abandon the session and display the 

			' login failed page

			Session.Abandon

			Response.Redirect "logon2.asp"

		End If	

	End If	

End Sub

</SCRIPT>

<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart

	'==Visual InterDev Generated - startspan==

	'--Project Data Connection

		Application("maxxschedule_ConnectionString") 

= "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data 

Source=F:\calendar\calendar_Local\data\MaxxSchedule.mdb;Mode=Share Deny 

None;Extended Properties="""";Jet OLEDB:System database="""";Jet 

OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine 

Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk 

Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database 

Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt 

Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet 

OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False;User 

Id=Admin;Password=;"

		Application("maxxschedule_ConnectionTimeout") = 15

		Application("maxxschedule_CommandTimeout") = 30

		Application("maxxschedule_CursorLocation") = 3

		Application("maxxschedule_RuntimeUserName") = "Admin"

		Application("maxxschedule_RuntimePassword") = ""

	'-- Project Data Environment

		'Set DE = Server.CreateObject("DERuntime.DERuntime")

		'Application("DE") = DE.Load(Server.MapPath

("Global.ASA"), "_private/DataEnvironment/DataEnvironment.asa")

	'==Visual InterDev Generated - endspan==

End Sub

</SCRIPT>

      

---



Your message: (INMAIL-ID:47291)



X-Mailer: P2P web interface

Date: Tue, 20 Nov 2001 22:44:56

From: "Larry Rosenzweig" <rosenzl@o...>

To: access_asp@p...

Subject: Runtime Error assoc with Global.asa file(I left out some code for 

Logon2.asp)





I just learned how to use the Session Objects. I used the "Site Security 

Sample: Design Documentation." It uses the Session_OnStart event. I got it 

to work fine. Then I started a new application in which I copied all my 

pages and includes, and the database, from my existing application(not the 

Site Securit Sample). I made changes to various pages so it would conform 

to the sample application above. My problem follows;



My first page is a Logon page(UserID and Password), called Logon2.asp. It 

has a Form action = Default.asp. After entering the user id and password, 

I get the following error;



"An exception of type "Runtime Error was not handled. Would you like to 

debug the application?". When I respond with "Yes", Interdev points to the 

following line in Global.asa.   Session.Timeout = 10



Please see the code for Logon2.asp and Global.asa below. I believe it has 

something to do with opening the recordset, but can't prove it. 



Thank you very much for any help with this.



Larry 



___________________________________________________________________________

Logon2.asp





<%@LANGUAGE="VBScript" ENABLESESSIONSTATE=false%>



<%'ENABLESESSIONSTATE=True Needed so Form elements 

'will be passed the first time (bug???)%>



<%Option Explicit%>



<%Response.Expires = -1%>



<%Response.Buffer = True%>



<!--#Include File="config.inc"-->



<html>

<head>

<title>Administrative Server Logon</title>

</head>



<!--#Include File="comtop.inc"-->



<table ALIGN="CENTER" CELLPADDING="8" CELLSPACING="0" BORDER="0">

<tr><td CLASS="clsTop" COLSPAN="2">

<b>Welcome to the Reservation system </b>

</td></tr>



<tr><td CLASS="clsTD2" COLSPAN="2">

<img SRC="images/key.gif" BORDER="0" WIDTH="22" HEIGHT="10">&nbsp;

Please Logon to the Schedule

<br>

<form ACTION="default.asp" METHOD="post" NAME="frmLogon">   

<tr>

<td CLASS="clsTD" ALIGN="CENTER">

    &nbsp;

    <p>User ID:</p>

    <p>Password:&nbsp;</p>

    <p>&nbsp;</p>

</td>

<td CLASS="clsTD2">	

	<input NAME="txtuserid" CLASS="Text" SIZE="20">  

    <p>	

	<input TYPE="password" NAME="txtpassword" CLASS="clsInput2" 

SIZE="20">

    </p>

</td>

</tr>

<tr><td CLASS="clsBottom" COLSPAN="2" ALIGN="CENTER"><br>

	<input TYPE="SUBMIT" VALUE="Submit" CLASS="clsInput" 

NAME="btnSubmit" ONMOUSEOVER="buttonchange('1')" ONMOUSEOUT="buttonchange

('0')">

	 

</td></tr>



</form>

</table>



      

<!--#Include File="combot.inc"-->

___________________________________________________________________________

Global.asa



  

<form ACTION="default.asp" METHOD="post" NAME="frmLogon">   

<tr>

<td CLASS="clsTD" ALIGN="CENTER">

    &nbsp;

    <p>User ID:</p>

    <p>Password:&nbsp;</p>

    <p>&nbsp;</p>

</td>

<td CLASS="clsTD2">	

	<input NAME="txtuserid" CLASS="Text" SIZE="20">  

    <p>	

	<input TYPE="password" NAME="txtpassword" CLASS="clsInput2" 

SIZE="20">

    </p>

</td>

</tr>

<tr><td CLASS="clsBottom" COLSPAN="2" ALIGN="CENTER"><br>

	<input TYPE="SUBMIT" VALUE="Submit" CLASS="clsInput" 

NAME="btnSubmit" ONMOUSEOVER="buttonchange('1')" ONMOUSEOUT="buttonchange

('0')">

	 

</td></tr>



</form>

</table>



      

<!--#Include File="combot.inc"-->



 



<SCRIPT LANGUAGE=VBScript RUNAT=Server>



'You can add special event handlers in this file that will get run 

automatically when

'special Active Server Pages events occur. To create these handlers, just 

create a

'subroutine with a name from the list below that corresponds to the event 

you want to

'use. For example, to create an event handler for Session_OnStart, you 

would put the

'following code into this file (without the comments):



'Sub Session_OnStart

'**Put your code here **

'End Sub



'EventName              Description

'Session_OnStart        Runs the first time a user runs any page in your 

application

'Session_OnEnd          Runs when a user's session times out or quits your 

application

'Application_OnStart    Runs once when the first page of your application 

is run for the first time by any user

'Application_OnEnd      Runs once when the web server shuts down



</SCRIPT>





<SCRIPT LANGUAGE=VBScript RUNAT=Server>



' try to validate the user, see comments in pgAccountAccess.htm

Sub Session_OnStart

	Dim cn				' ado connection object

	Dim rs				' ado recordset object

	Dim strSQL			' sql query string

	Dim struserid	' name of user(from logon2.asp)

	Dim strPassword		' password (from logon2.asp)



	' set session timeout to 10 minutes

	Session.Timeout = 10



	' get the login info the user entered in logon2.asp

	struserid = Request.Form("txtuserid")

	strPassword = Request.Form("txtPassword")



	' make sure they did not leave the fields blank

	If struserid = "" And strPassword = "" Then

		' no login information at all, abandon the 

		' session and send to the login page

		Session.Abandon

		Response.Write "session abandoned"

		Response.Redirect "logon2.asp"

	Else

		' see if user entered valid login information

		

		' first, create the connection and recordset

		Set cn = Server.CreateObject("ADODB.Connection")

		Set rs = Server.CreateObject("ADODB.Recordset")

	

		' build the query string using info collected from the

		' login page (pgAccountAccess.htm)

		strSQL = "SELECT userid, logon FROM tbllogons WHERE " & _

			"(UserID = '" & struserid & "') AND " & _

			"(Logon = '" & strPassword & "')"

	

		' Open the connection, the connection string, username and 

password

		' are stored in the Application object which was created 

by the 

		' Data Environment connection wizard

		cn.Open Application("maxxschedule_ConnectionString"), _

			Application("maxxschedule_RuntimeUserName"), _

			Application("maxxschedule_RuntimePassword")

			

		' open the recordset

		rs.Open strSQL, cn



		' see if found a recordset, if we did, the user entered

		' valid information in the login page

		If Not rs.EOF Then

			' login successful

			' save variables that can be accessed by other 

pages

			Session("Logon") = rs("Logon")

			Session("UserID") = rs("UserID")



			' clean up the ado objects

			Set cn = Nothing

			Set rs = Nothing	

	

			' display the success page

			Response.Redirect "default.asp"

		Else

			' login failed

			' clean up the ado objects

			Set cn = Nothing

			Set rs = Nothing	



			' abandon the session and display the 

			' login failed page

			Session.Abandon

			Response.Redirect "logon2.asp"

		End If	

	End If	

End Sub

</SCRIPT>

<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart

	'==Visual InterDev Generated - startspan==

	'--Project Data Connection

		Application("maxxschedule_ConnectionString") 

= "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data 

Source=F:\calendar\calendar_Local\data\MaxxSchedule.mdb;Mode=Share Deny 

None;Extended Properties="""";Jet OLEDB:System database="""";Jet 

OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine 

Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk 

Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database 

Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt 

Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet 

OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False;User 

Id=Admin;Password=;"

		Application("maxxschedule_ConnectionTimeout") = 15

		Application("maxxschedule_CommandTimeout") = 30

		Application("maxxschedule_CursorLocation") = 3

		Application("maxxschedule_RuntimeUserName") = "Admin"

		Application("maxxschedule_RuntimePassword") = ""

	'-- Project Data Environment

		'Set DE = Server.CreateObject("DERuntime.DERuntime")

		'Application("DE") = DE.Load(Server.MapPath

("Global.ASA"), "_private/DataEnvironment/DataEnvironment.asa")

	'==Visual InterDev Generated - endspan==

End Sub

</SCRIPT>

Message #2 by "Ken Schaefer" <ken@a...> on Wed, 21 Nov 2001 12:28:19 +1100
Larry,



The session_OnStart event is raised when the session starts ie when the

first page is requested by the user. The code is processed *before* anything

is sent to the user. You can't call it from within your pages.



What you really need to do is:

a) The user enters their user credentials

b) You verify these against what is in the database. If they are OK, you set

a session variable to indictate that the user has logged in.

c) At the top of each "protected" page you check for the existance of this

session variable. If it isn't present, you redirect to the login page.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "Larry Rosenzweig" <rosenzl@o...>

To: "Access ASP" <access_asp@p...>

Sent: Tuesday, November 20, 2001 11:04 PM

Subject: [access_asp] Sorry, I left the last part of the code for Logon2.asp

out. Below contains everything.





: This is now complete.

:

: I just learned how to use the Session Objects. I used the "Site Security

: Sample: Design Documentation." It uses the Session_OnStart event. I got it

: to work fine. Then I started a new application in which I copied all my

: pages and includes, and the database, from my existing application(not the

: Site Securit Sample). I made changes to various pages so it would conform

: to the sample application above. My problem follows;

:

: My first page is a Logon page(UserID and Password), called Logon2.asp. It

: has a Form action = Default.asp. After entering the user id and password,

: I get the following error;

:

: "An exception of type "Runtime Error was not handled. Would you like to

: debug the application?". When I respond with "Yes", Interdev points to the

: following line in Global.asa.   Session.Timeout = 10





Message #3 by lrosenzweig <rosenzl@o...> on Tue, 20 Nov 2001 22:01:55 -0500
Ken, thanks for responding. I realize what you are saying. The fact that the

error described points to Global.asa, indicates to me that there is a

connection problem. In other words, it did not successfully get through the

Global.asa code. That's why I included that code in my prior email.

Specifically, it pointed to "Session.Timeout = 10, with the message,

"Runtime Error was not handled".



My understanding is that once the user id and password are entered, it will

trigger the Session_OnStart to execute. It is in that Session_OnStart where

the problem is. The Global.asa code is attempting to verify that what the

user entered is on the database.



HELP!



-----Original Message-----

From: Ken Schaefer [mailto:ken@a...]

Sent: Tuesday, November 20, 2001 8:28 PM

To: Access ASP

Subject: [access_asp] Re: Sorry, I left the last part of the code for

Logon2.asp out. Below contains everything.



Larry,



The session_OnStart event is raised when the session starts ie when the

first page is requested by the user. The code is processed *before* anything

is sent to the user. You can't call it from within your pages.



What you really need to do is:

a) The user enters their user credentials

b) You verify these against what is in the database. If they are OK, you set

a session variable to indictate that the user has logged in.

c) At the top of each "protected" page you check for the existance of this

session variable. If it isn't present, you redirect to the login page.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "Larry Rosenzweig" <rosenzl@o...>

To: "Access ASP" <access_asp@p...>

Sent: Tuesday, November 20, 2001 11:04 PM

Subject: [access_asp] Sorry, I left the last part of the code for Logon2.asp

out. Below contains everything.





: This is now complete.

:

: I just learned how to use the Session Objects. I used the "Site Security

: Sample: Design Documentation." It uses the Session_OnStart event. I got it

: to work fine. Then I started a new application in which I copied all my

: pages and includes, and the database, from my existing application(not the

: Site Securit Sample). I made changes to various pages so it would conform

: to the sample application above. My problem follows;

:

: My first page is a Logon page(UserID and Password), called Logon2.asp. It

: has a Form action = Default.asp. After entering the user id and password,

: I get the following error;

:

: "An exception of type "Runtime Error was not handled. Would you like to

: debug the application?". When I respond with "Yes", Interdev points to the

: following line in Global.asa.   Session.Timeout = 10












Message #4 by "Ken Schaefer" <ken@a...> on Wed, 21 Nov 2001 14:14:47 +1100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "lrosenzweig" <rosenzl@o...>

Subject: [access_asp] Re: Sorry, I left the last part of the code for

Logon2.asp out. Below contains everything.





: My understanding is that once the user id and password are entered, it

will

: trigger the Session_OnStart to execute.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



This is where you are making a mistake.

The Session_OnStart event is raised when the *session* starts (funnily

enough). This occurs when the user makes the *first* request for a webpage.

The code in Session_OnStart is processed *before* the first request is

handled by IIS:



a) User requests first webpage using web-browser

b) Session_OnStart is fired

c) IIS processes request and returns webpage



As I said before - to verify the user's crendentials you get their POSTed

data, and you process this in another webpage, not in the global.asa



Cheers

Ken



Message #5 by lrosenzweig <rosenzl@o...> on Wed, 21 Nov 2001 11:49:18 -0500
Ken, There is specific logic in the Global.asa to establish whether or not

the user entered their user id and/or if it is valid. My error occurs after

the user submits from the logon page. The error is pointing to the

global.asa line 33, which is Session.Timeout = 10.

Sequence of events;



1. Do View in Browser (It brings up the Logon page)

2. Enter User ID and Password (Submit)

3. I get the following error ("An execution of type 'Runtime Error' was not

handled. Do you want to debug?")

4. I responded with "Yes" and Interdev opens with "Session.Timeout = 10"

highlighted as the error.



I don't know how to resolve this error.



Larry

-----Original Message-----

From: Ken Schaefer [mailto:ken@a...]

Sent: Tuesday, November 20, 2001 10:15 PM

To: Access ASP

Subject: [access_asp] Re: Sorry, I left the last part of the code for

Logon2.asp out. Below contains everything.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "lrosenzweig" <rosenzl@o...>

Subject: [access_asp] Re: Sorry, I left the last part of the code for

Logon2.asp out. Below contains everything.





: My understanding is that once the user id and password are entered, it

will

: trigger the Session_OnStart to execute.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



This is where you are making a mistake.

The Session_OnStart event is raised when the *session* starts (funnily

enough). This occurs when the user makes the *first* request for a webpage.

The code in Session_OnStart is processed *before* the first request is

handled by IIS:



a) User requests first webpage using web-browser

b) Session_OnStart is fired

c) IIS processes request and returns webpage



As I said before - to verify the user's crendentials you get their POSTed

data, and you process this in another webpage, not in the global.asa



Cheers

Ken










Message #6 by "Ken Schaefer" <ken@a...> on Thu, 22 Nov 2001 22:25:50 +1100
Larry,



I don't know how many times I can say this...



You can't put code in your global.asa Session_OnStart event to process a

login. The session_OnStart event is processed *before* the first page is

returned to the user, ie even before the login page is presented that the

user fills in - there is no way you can pass the username and password to

the code you have in your global.asa.



You also can't response.write stuff from your global.asa - remember, this

page is never requested by the user (or it shouldn't be...)



I'm not sure why the debugger is pointing to Session.Timeout - that

shouldn't be causing a problem - the rest of the code you have in there will

(or should be) causing a problem. To handle the login code (connecting to

database, response.writeing information), you need to post the form to

another .asp page. You can't handle this in the global.asa



I suggest you invest in Beginning Active Server Pages v3 by Wrox Press since

we have a conceptual problem here.





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "lrosenzweig" <rosenzl@o...>

To: "Access ASP" <access_asp@p...>

Sent: Thursday, November 22, 2001 3:49 AM

Subject: [access_asp] Re: Sorry, I left the last part of the code for

Logon2.asp out. Below contains everything.





: Ken, There is specific logic in the Global.asa to establish whether or not

: the user entered their user id and/or if it is valid. My error occurs

after

: the user submits from the logon page. The error is pointing to the

: global.asa line 33, which is Session.Timeout = 10.

: Sequence of events;

:

: 1. Do View in Browser (It brings up the Logon page)

: 2. Enter User ID and Password (Submit)

: 3. I get the following error ("An execution of type 'Runtime Error' was

not

: handled. Do you want to debug?")

: 4. I responded with "Yes" and Interdev opens with "Session.Timeout = 10"

: highlighted as the error.

:

: I don't know how to resolve this error.





Message #7 by lrosenzweig <rosenzl@o...> on Thu, 22 Nov 2001 07:53:19 -0500
Ken, Please see the MSDN download below. It has the Sample code which does

just what you say can't be done. By the way, I agree with the response.write

statement. I was just trying everything I could to find the problem. I

already have Beginning ASP Databases by John Kauffman.



http://msdn.microsoft.com/vinterdev/downloads/download.asp?ID=019



Thanks and Happy Thanksgiving



Larry



-----Original Message-----

From: Ken Schaefer [mailto:ken@a...]

Sent: Thursday, November 22, 2001 6:26 AM

To: Access ASP

Subject: [access_asp] Re: Sorry, I left the last part of the code for

Logon2.asp out. Below contains everything.



Larry,



I don't know how many times I can say this...



You can't put code in your global.asa Session_OnStart event to process a

login. The session_OnStart event is processed *before* the first page is

returned to the user, ie even before the login page is presented that the

user fills in - there is no way you can pass the username and password to

the code you have in your global.asa.



You also can't response.write stuff from your global.asa - remember, this

page is never requested by the user (or it shouldn't be...)



I'm not sure why the debugger is pointing to Session.Timeout - that

shouldn't be causing a problem - the rest of the code you have in there will

(or should be) causing a problem. To handle the login code (connecting to

database, response.writeing information), you need to post the form to

another .asp page. You can't handle this in the global.asa



I suggest you invest in Beginning Active Server Pages v3 by Wrox Press since

we have a conceptual problem here.





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "lrosenzweig" <rosenzl@o...>

To: "Access ASP" <access_asp@p...>

Sent: Thursday, November 22, 2001 3:49 AM

Subject: [access_asp] Re: Sorry, I left the last part of the code for

Logon2.asp out. Below contains everything.





: Ken, There is specific logic in the Global.asa to establish whether or not

: the user entered their user id and/or if it is valid. My error occurs

after

: the user submits from the logon page. The error is pointing to the

: global.asa line 33, which is Session.Timeout = 10.

: Sequence of events;

:

: 1. Do View in Browser (It brings up the Logon page)

: 2. Enter User ID and Password (Submit)

: 3. I get the following error ("An execution of type 'Runtime Error' was

not

: handled. Do you want to debug?")

: 4. I responded with "Yes" and Interdev opens with "Session.Timeout = 10"

: highlighted as the error.

:

: I don't know how to resolve this error.












Message #8 by "Ken Schaefer" <ken@a...> on Fri, 23 Nov 2001 16:56:32 +1100
OK, I see the sample, and how they get it to work (using a .htm page rather

than a .asp page to get the login information, hence bypassing

Session_onStart).



How I would handle this is a little different.



Create one page to get the login credentials.

Post that data to a second .asp page. Take the code that is in the VID

sample you downloaded (in the session_OnStart routine), and put it into the

second ASP page instead.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "lrosenzweig" <rosenzl@o...>

Subject: [access_asp] Re: Sorry, I left the last part of the code for

Logon2.asp out. Below contains everything.





: Ken, Please see the MSDN download below. It has the Sample code which does

: just what you say can't be done. By the way, I agree with the

response.write

: statement. I was just trying everything I could to find the problem. I

: already have Beginning ASP Databases by John Kauffman.

:

: http://msdn.microsoft.com/vinterdev/downloads/download.asp?ID=019



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




  Return to Index