Session Stage\Variables

R

Rick

We are in the process of testing a large web project that I converted from
VS 2003 to VS 2005. Everything seems to be working except for a few minor
things. But the main issue I have is this, I have about 5 or 6 developers
testing this web site in a staging environment on a Microsoft 2003 Server
box. We have a base page that gets called on every page and checks for
session variables. After about 20 - 30 minutes these session variables are
getting cleared out and throwing an "object reference not set to an instance
of an object" error, this is due to the session variable all of sudden no
longer exists, This was not an issue with 2003.

I have sessionstate enabled and set to timeout at 20. My understanding is it
shouldn't time out for everyone at the same time and should time out if the
session is active.

Leading up to the time the error shows, I get this error in the eventlog:

Event Type: Information
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1314
Date: 9/27/2007
Time: 1:48:01 PM
User: N/A
Computer: STAGE1
Description:
Event code: 4011
Event message: An unhandled access exception has occurred.
Event time: 9/27/2007 1:48:01 PM
Event time (UTC): 9/27/2007 6:48:01 PM
Event ID: e491a210450c499da175a8f79bda9e4e
Event sequence: 1342
Event occurrence: 6
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/1203720951/Root-6-128353913468396400
Trust level: Full
Application Virtual Path: /
Application Path: D:\Hosting\digecenterv2.com\www-stage\html\
Machine name: STAGE1

Process information:
Process ID: 6300
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Request information:
Request URL:
Request path:
User host address:
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Custom event details:

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Any suggestions?

Thanks in advance!
Rick
 
R

Robbe Morris - [MVP] C#

You set the timeout for 20 minutes and you say it starts throwing errors
after 20 minutes? Uh, isn't that what you would expect?

Also, why aren't you trapping for the existance of the session variable
prior to trying to access it? That has been an issue since for over
6 years now. That's not new in .NET 2.0.

You could also paste this in your global.asax and log the
error.

using System.Diagnostics;

protected void Application_Error(object sender, EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string err = "Error Caught in Application_Error event\n" +
"Error in: " + Request.Url.ToString() +
"\nError Message:" + objErr.Message.ToString()+
"\nStack Trace:" + objErr.StackTrace.ToString();
EventLog.WriteEntry("Sample_WebApp",err,EventLogEntryType.Error);
Server.ClearError();
//additional actions...
}

You may have an unhandled error somewhere in the app
that is causing IIS to shutdown the app pool (which will kill
InProc Session) and restart it.

--
Robbe Morris [Microsoft MVP - Visual C#]
..NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx
 
G

George Ter-Saakov

The main difference between .NET 1.1 and .NET 2.0 (VS 2003 and VS 2005) is
that if you had a worker thread and it throws unhandled exception then the
whole process is terminated. It was not the case with .NET 1.1

In IIS environment the process is restarted instead of simple shutdown but
Session variables are lost and exception (similar to yours) is logged into
NT event log.

So look if you have a worker threads and enclose them into try.. catch...

PS: worker threads are the ones that you created yourself. Normal flow of
ASP.NET pages are normal threads and ASP.NET aware of them and catches all
exception thrown for you.


George.
 
G

George Ter-Saakov

I do not believe that it throws an unhandled exception.
It will not terminate the process.
Might give the user an error message but sessions will be intact.

George.


Robbe Morris - [MVP] C# said:
True. One possiblity "might" be Server.Transfer and Response.Redirect
and not using a return statement right afterwards.

Response.Redirect("blah.aspx",false);
return;

I've seen this throw exceptions if the return line is missing.



--
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




George Ter-Saakov said:
The main difference between .NET 1.1 and .NET 2.0 (VS 2003 and VS 2005)
is that if you had a worker thread and it throws unhandled exception then
the whole process is terminated. It was not the case with .NET 1.1

In IIS environment the process is restarted instead of simple shutdown
but Session variables are lost and exception (similar to yours) is logged
into NT event log.

So look if you have a worker threads and enclose them into try.. catch...

PS: worker threads are the ones that you created yourself. Normal flow of
ASP.NET pages are normal threads and ASP.NET aware of them and catches
all exception thrown for you.


George.
 
R

Robbe Morris - [MVP] C#

It throws thread abort exceptions.

--
Robbe Morris [Microsoft MVP - Visual C#]
..NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




George Ter-Saakov said:
I do not believe that it throws an unhandled exception.
It will not terminate the process.
Might give the user an error message but sessions will be intact.

George.


Robbe Morris - [MVP] C# said:
True. One possiblity "might" be Server.Transfer and Response.Redirect
and not using a return statement right afterwards.

Response.Redirect("blah.aspx",false);
return;

I've seen this throw exceptions if the return line is missing.



--
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




George Ter-Saakov said:
The main difference between .NET 1.1 and .NET 2.0 (VS 2003 and VS 2005)
is that if you had a worker thread and it throws unhandled exception
then the whole process is terminated. It was not the case with .NET 1.1

In IIS environment the process is restarted instead of simple shutdown
but Session variables are lost and exception (similar to yours) is
logged into NT event log.

So look if you have a worker threads and enclose them into try..
catch...

PS: worker threads are the ones that you created yourself. Normal flow
of ASP.NET pages are normal threads and ASP.NET aware of them and
catches all exception thrown for you.


George.





We are in the process of testing a large web project that I converted
from VS 2003 to VS 2005. Everything seems to be working except for a
few minor things. But the main issue I have is this, I have about 5 or
6 developers testing this web site in a staging environment on a
Microsoft 2003 Server box. We have a base page that gets called on
every page and checks for session variables. After about 20 - 30
minutes these session variables are getting cleared out and throwing an
"object reference not set to an instance of an object" error, this is
due to the session variable all of sudden no longer exists, This was
not an issue with 2003.

I have sessionstate enabled and set to timeout at 20. My understanding
is it shouldn't time out for everyone at the same time and should time
out if the session is active.

Leading up to the time the error shows, I get this error in the
eventlog:

Event Type: Information
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1314
Date: 9/27/2007
Time: 1:48:01 PM
User: N/A
Computer: STAGE1
Description:
Event code: 4011
Event message: An unhandled access exception has occurred.
Event time: 9/27/2007 1:48:01 PM
Event time (UTC): 9/27/2007 6:48:01 PM
Event ID: e491a210450c499da175a8f79bda9e4e
Event sequence: 1342
Event occurrence: 6
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/1203720951/Root-6-128353913468396400
Trust level: Full
Application Virtual Path: /
Application Path: D:\Hosting\digecenterv2.com\www-stage\html\
Machine name: STAGE1

Process information:
Process ID: 6300
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Request information:
Request URL:
Request path:
User host address:
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Custom event details:

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Any suggestions?

Thanks in advance!
Rick
 
G

George Ter-Saakov

But it's not unhandled.....
it's catched inside of ASP.NET framework...

am i right? Only unhandled, ie the ones that go without catch, are
dangerous.


George.

Robbe Morris - [MVP] C# said:
It throws thread abort exceptions.

--
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




George Ter-Saakov said:
I do not believe that it throws an unhandled exception.
It will not terminate the process.
Might give the user an error message but sessions will be intact.

George.


Robbe Morris - [MVP] C# said:
True. One possiblity "might" be Server.Transfer and Response.Redirect
and not using a return statement right afterwards.

Response.Redirect("blah.aspx",false);
return;

I've seen this throw exceptions if the return line is missing.



--
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




The main difference between .NET 1.1 and .NET 2.0 (VS 2003 and VS 2005)
is that if you had a worker thread and it throws unhandled exception
then the whole process is terminated. It was not the case with .NET 1.1

In IIS environment the process is restarted instead of simple shutdown
but Session variables are lost and exception (similar to yours) is
logged into NT event log.

So look if you have a worker threads and enclose them into try..
catch...

PS: worker threads are the ones that you created yourself. Normal flow
of ASP.NET pages are normal threads and ASP.NET aware of them and
catches all exception thrown for you.


George.





We are in the process of testing a large web project that I converted
from VS 2003 to VS 2005. Everything seems to be working except for a
few minor things. But the main issue I have is this, I have about 5 or
6 developers testing this web site in a staging environment on a
Microsoft 2003 Server box. We have a base page that gets called on
every page and checks for session variables. After about 20 - 30
minutes these session variables are getting cleared out and throwing
an "object reference not set to an instance of an object" error, this
is due to the session variable all of sudden no longer exists, This
was not an issue with 2003.

I have sessionstate enabled and set to timeout at 20. My understanding
is it shouldn't time out for everyone at the same time and should time
out if the session is active.

Leading up to the time the error shows, I get this error in the
eventlog:

Event Type: Information
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1314
Date: 9/27/2007
Time: 1:48:01 PM
User: N/A
Computer: STAGE1
Description:
Event code: 4011
Event message: An unhandled access exception has occurred.
Event time: 9/27/2007 1:48:01 PM
Event time (UTC): 9/27/2007 6:48:01 PM
Event ID: e491a210450c499da175a8f79bda9e4e
Event sequence: 1342
Event occurrence: 6
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/1203720951/Root-6-128353913468396400
Trust level: Full
Application Virtual Path: /
Application Path: D:\Hosting\digecenterv2.com\www-stage\html\
Machine name: STAGE1

Process information:
Process ID: 6300
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Request information:
Request URL:
Request path:
User host address:
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Custom event details:

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Any suggestions?

Thanks in advance!
Rick
 
R

Rick

Thanks for the input!
Here is one thing I discovered with the code(by the way I didn't write this
it was inherted from other developers who are no longer here).
We have a data layer that accepts queries and excecutes them etc ...
Within this data layer the exceptions are handled and logged to the event
log. within the try catch after logging the exception, the code throws a new
exception to bubble up to the calling class, this is were I am getting an
unhandled exception error. So, this worked in 1.1 and bubbled the exception
but now it doesn't in 2.0. What is the correct way to accomplish this?

Sample Code:

Try
runSQL(SQL)
Catch EX as exception
logexceptionfromDatalayer(EX)
End Try


Public Function runSQL(ByVal SQL As String) As Boolean

Try

execute the query here

Catch ExceptionObject As Exception

logexception(ExceptionObject )

Throw New Exception("DataLayerName", ExceptionObject)

Finally

'Clean up

End Try

End Function
 
G

George Ter-Saakov

this is correct approach.
I am not sure why you saying it's not working...... I do not see any obvious
problem....

The only reason I might suggest is that your logexception is throwing some
other error so it actually never makes to your next statement
Throw New Exception("DataLayerName", ExceptionObject)


George.
 
R

Rick

I walked through the code line by line, It is making it to the next
statement, then as soon as it breaks on the finally it throws an Exception
was unhandled by user code error
 
R

Robbe Morris - [MVP] C#

You might right come to think of it. I just get picky about
"no" exceptions at all.

--
Robbe Morris [Microsoft MVP - Visual C#]
..NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




George Ter-Saakov said:
But it's not unhandled.....
it's catched inside of ASP.NET framework...

am i right? Only unhandled, ie the ones that go without catch, are
dangerous.


George.

Robbe Morris - [MVP] C# said:
It throws thread abort exceptions.

--
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




George Ter-Saakov said:
I do not believe that it throws an unhandled exception.
It will not terminate the process.
Might give the user an error message but sessions will be intact.

George.


True. One possiblity "might" be Server.Transfer and Response.Redirect
and not using a return statement right afterwards.

Response.Redirect("blah.aspx",false);
return;

I've seen this throw exceptions if the return line is missing.



--
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




The main difference between .NET 1.1 and .NET 2.0 (VS 2003 and VS
2005) is that if you had a worker thread and it throws unhandled
exception then the whole process is terminated. It was not the case
with .NET 1.1

In IIS environment the process is restarted instead of simple shutdown
but Session variables are lost and exception (similar to yours) is
logged into NT event log.

So look if you have a worker threads and enclose them into try..
catch...

PS: worker threads are the ones that you created yourself. Normal flow
of ASP.NET pages are normal threads and ASP.NET aware of them and
catches all exception thrown for you.


George.





We are in the process of testing a large web project that I converted
from VS 2003 to VS 2005. Everything seems to be working except for a
few minor things. But the main issue I have is this, I have about 5
or 6 developers testing this web site in a staging environment on a
Microsoft 2003 Server box. We have a base page that gets called on
every page and checks for session variables. After about 20 - 30
minutes these session variables are getting cleared out and throwing
an "object reference not set to an instance of an object" error, this
is due to the session variable all of sudden no longer exists, This
was not an issue with 2003.

I have sessionstate enabled and set to timeout at 20. My
understanding is it shouldn't time out for everyone at the same time
and should time out if the session is active.

Leading up to the time the error shows, I get this error in the
eventlog:

Event Type: Information
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1314
Date: 9/27/2007
Time: 1:48:01 PM
User: N/A
Computer: STAGE1
Description:
Event code: 4011
Event message: An unhandled access exception has occurred.
Event time: 9/27/2007 1:48:01 PM
Event time (UTC): 9/27/2007 6:48:01 PM
Event ID: e491a210450c499da175a8f79bda9e4e
Event sequence: 1342
Event occurrence: 6
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/1203720951/Root-6-128353913468396400
Trust level: Full
Application Virtual Path: /
Application Path: D:\Hosting\digecenterv2.com\www-stage\html\
Machine name: STAGE1

Process information:
Process ID: 6300
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Request information:
Request URL:
Request path:
User host address:
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Custom event details:

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Any suggestions?

Thanks in advance!
Rick
 
R

Rick

It is logging a database error, it's a Foreign Key constraint error, but
that should be picked up by the Catch and throw an Unhandled exeption.

I did read an article about these Unhandle Exceptions that said go to VS
Options Debugging\General and uncheck Enable Just My Code, this keeps the
Unhandled exception from happening when in Debug mode, but is this just
masking the problem?

Robbe Morris - [MVP] C# said:
Is it actually logging a database error anywhere?

You might want to put a line to exit out of the database
error logging method prior to it performing any action.

It would be interesting to see if something funny
is going on down there....

--
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




Rick said:
I walked through the code line by line, It is making it to the next
statement, then as soon as it breaks on the finally it throws an Exception
was unhandled by user code error
 
R

Rick

I meant to say:

It is logging a database error, it's a Foreign Key constraint error, but
that should be picked up by the Catch and NOT throw an Unhandled exeption.

Rick said:
It is logging a database error, it's a Foreign Key constraint error, but
that should be picked up by the Catch and throw an Unhandled exeption.

I did read an article about these Unhandle Exceptions that said go to VS
Options Debugging\General and uncheck Enable Just My Code, this keeps the
Unhandled exception from happening when in Debug mode, but is this just
masking the problem?

Robbe Morris - [MVP] C# said:
Is it actually logging a database error anywhere?

You might want to put a line to exit out of the database
error logging method prior to it performing any action.

It would be interesting to see if something funny
is going on down there....

--
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




Rick said:
I walked through the code line by line, It is making it to the next
statement, then as soon as it breaks on the finally it throws an
Exception was unhandled by user code error

this is correct approach.
I am not sure why you saying it's not working...... I do not see any
obvious problem....

The only reason I might suggest is that your logexception is throwing
some other error so it actually never makes to your next statement
Throw New Exception("DataLayerName", ExceptionObject)


George.


Thanks for the input!
Here is one thing I discovered with the code(by the way I didn't write
this it was inherted from other developers who are no longer here).
We have a data layer that accepts queries and excecutes them etc ...
Within this data layer the exceptions are handled and logged to the
event log. within the try catch after logging the exception, the code
throws a new exception to bubble up to the calling class, this is were
I am getting an unhandled exception error. So, this worked in 1.1 and
bubbled the exception but now it doesn't in 2.0. What is the correct
way to accomplish this?

Sample Code:

Try
runSQL(SQL)
Catch EX as exception
logexceptionfromDatalayer(EX)
End Try


Public Function runSQL(ByVal SQL As String) As Boolean

Try

execute the query here

Catch ExceptionObject As Exception

logexception(ExceptionObject )

Throw New Exception("DataLayerName", ExceptionObject)

Finally

'Clean up

End Try

End Function




The main difference between .NET 1.1 and .NET 2.0 (VS 2003 and VS
2005) is that if you had a worker thread and it throws unhandled
exception then the whole process is terminated. It was not the case
with .NET 1.1

In IIS environment the process is restarted instead of simple
shutdown but Session variables are lost and exception (similar to
yours) is logged into NT event log.

So look if you have a worker threads and enclose them into try..
catch...

PS: worker threads are the ones that you created yourself. Normal
flow of ASP.NET pages are normal threads and ASP.NET aware of them
and catches all exception thrown for you.


George.





We are in the process of testing a large web project that I
converted from VS 2003 to VS 2005. Everything seems to be working
except for a few minor things. But the main issue I have is this, I
have about 5 or 6 developers testing this web site in a staging
environment on a Microsoft 2003 Server box. We have a base page that
gets called on every page and checks for session variables. After
about 20 - 30 minutes these session variables are getting cleared
out and throwing an "object reference not set to an instance of an
object" error, this is due to the session variable all of sudden no
longer exists, This was not an issue with 2003.

I have sessionstate enabled and set to timeout at 20. My
understanding is it shouldn't time out for everyone at the same time
and should time out if the session is active.

Leading up to the time the error shows, I get this error in the
eventlog:

Event Type: Information
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1314
Date: 9/27/2007
Time: 1:48:01 PM
User: N/A
Computer: STAGE1
Description:
Event code: 4011
Event message: An unhandled access exception has occurred.
Event time: 9/27/2007 1:48:01 PM
Event time (UTC): 9/27/2007 6:48:01 PM
Event ID: e491a210450c499da175a8f79bda9e4e
Event sequence: 1342
Event occurrence: 6
Event detail code: 0

Application information:
Application domain:
/LM/W3SVC/1203720951/Root-6-128353913468396400
Trust level: Full
Application Virtual Path: /
Application Path: D:\Hosting\digecenterv2.com\www-stage\html\
Machine name: STAGE1

Process information:
Process ID: 6300
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Request information:
Request URL:
Request path:
User host address:
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Custom event details:

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Any suggestions?

Thanks in advance!
Rick
 
R

Robbe Morris - [MVP] C#

Got me on this one. My view has always been

try
{
}
catch (whateverException) { throw; }

from the bottom all the way back up to the UI or
highest level endpoint before deciding how to handle the error.
This forces the application environment to manage this
process.

Not saying your way is wrong. Just saying I've never
opted to managing logging and handling of the same error
in multiple places.

--
Robbe Morris [Microsoft MVP - Visual C#]
..NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




Rick said:
I meant to say:

It is logging a database error, it's a Foreign Key constraint error, but
that should be picked up by the Catch and NOT throw an Unhandled exeption.

Rick said:
It is logging a database error, it's a Foreign Key constraint error, but
that should be picked up by the Catch and throw an Unhandled exeption.

I did read an article about these Unhandle Exceptions that said go to VS
Options Debugging\General and uncheck Enable Just My Code, this keeps the
Unhandled exception from happening when in Debug mode, but is this just
masking the problem?

Robbe Morris - [MVP] C# said:
Is it actually logging a database error anywhere?

You might want to put a line to exit out of the database
error logging method prior to it performing any action.

It would be interesting to see if something funny
is going on down there....

--
Robbe Morris [Microsoft MVP - Visual C#]
.NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorial...af-5cd3abe27a75/net-propertygrid-control.aspx




I walked through the code line by line, It is making it to the next
statement, then as soon as it breaks on the finally it throws an
Exception was unhandled by user code error

this is correct approach.
I am not sure why you saying it's not working...... I do not see any
obvious problem....

The only reason I might suggest is that your logexception is throwing
some other error so it actually never makes to your next statement
Throw New Exception("DataLayerName", ExceptionObject)


George.


Thanks for the input!
Here is one thing I discovered with the code(by the way I didn't
write this it was inherted from other developers who are no longer
here).
We have a data layer that accepts queries and excecutes them etc ...
Within this data layer the exceptions are handled and logged to the
event log. within the try catch after logging the exception, the code
throws a new exception to bubble up to the calling class, this is
were I am getting an unhandled exception error. So, this worked in
1.1 and bubbled the exception but now it doesn't in 2.0. What is the
correct way to accomplish this?

Sample Code:

Try
runSQL(SQL)
Catch EX as exception
logexceptionfromDatalayer(EX)
End Try


Public Function runSQL(ByVal SQL As String) As Boolean

Try

execute the query here

Catch ExceptionObject As Exception

logexception(ExceptionObject )

Throw New Exception("DataLayerName", ExceptionObject)

Finally

'Clean up

End Try

End Function




The main difference between .NET 1.1 and .NET 2.0 (VS 2003 and VS
2005) is that if you had a worker thread and it throws unhandled
exception then the whole process is terminated. It was not the case
with .NET 1.1

In IIS environment the process is restarted instead of simple
shutdown but Session variables are lost and exception (similar to
yours) is logged into NT event log.

So look if you have a worker threads and enclose them into try..
catch...

PS: worker threads are the ones that you created yourself. Normal
flow of ASP.NET pages are normal threads and ASP.NET aware of them
and catches all exception thrown for you.


George.





We are in the process of testing a large web project that I
converted from VS 2003 to VS 2005. Everything seems to be working
except for a few minor things. But the main issue I have is this, I
have about 5 or 6 developers testing this web site in a staging
environment on a Microsoft 2003 Server box. We have a base page
that gets called on every page and checks for session variables.
After about 20 - 30 minutes these session variables are getting
cleared out and throwing an "object reference not set to an
instance of an object" error, this is due to the session variable
all of sudden no longer exists, This was not an issue with 2003.

I have sessionstate enabled and set to timeout at 20. My
understanding is it shouldn't time out for everyone at the same
time and should time out if the session is active.

Leading up to the time the error shows, I get this error in the
eventlog:

Event Type: Information
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1314
Date: 9/27/2007
Time: 1:48:01 PM
User: N/A
Computer: STAGE1
Description:
Event code: 4011
Event message: An unhandled access exception has occurred.
Event time: 9/27/2007 1:48:01 PM
Event time (UTC): 9/27/2007 6:48:01 PM
Event ID: e491a210450c499da175a8f79bda9e4e
Event sequence: 1342
Event occurrence: 6
Event detail code: 0

Application information:
Application domain:
/LM/W3SVC/1203720951/Root-6-128353913468396400
Trust level: Full
Application Virtual Path: /
Application Path: D:\Hosting\digecenterv2.com\www-stage\html\
Machine name: STAGE1

Process information:
Process ID: 6300
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Request information:
Request URL:
Request path:
User host address:
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Custom event details:

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

Any suggestions?

Thanks in advance!
Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top