Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Session ending without any warning!

Reply
Thread Tools

Session ending without any warning!

 
 
Arti
Guest
Posts: n/a
 
      07-12-2007
Hi everybody,

I am using ASP.NET 2.0.

When redirecting from page1 to page2 using Response.Redirect() method
ThreadAbortException is raised.

In my condition sometimes even though this exception is caught and handled
by my code, the session_end method in global.asax is getting called, which
implies that all my sessions are ended and hence i am forced to login once
again!

Can somebody please let me know what i am missing here, any solution to
avoid this error...

Thanks and Regards.


 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      07-12-2007
"Arti" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> When redirecting from page1 to page2 using Response.Redirect() method
> ThreadAbortException is raised.
>
> In my condition sometimes even though this exception is caught and handled
> by my code, the session_end method in global.asax is getting called, which
> implies that all my sessions are ended and hence i am forced to login once
> again!
>
> Can somebody please let me know what i am missing here, any solution to
> avoid this error...


The Response.Redirect method has an overload whereby you tell it not to
abort the thread:
http://msdn2.microsoft.com/en-us/lib...dt(VS.80).aspx

I'm not convinced that this will solve the problem, though, because it
certainly shouldn't be tearing down your session...

Worth a try in the first instance, though...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      07-12-2007
"Arti" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi everybody,
>
> I am using ASP.NET 2.0.
>
> When redirecting from page1 to page2 using Response.Redirect() method
> ThreadAbortException is raised.
>
> In my condition sometimes even though this exception is caught and handled
> by my code, the session_end method in global.asax is getting called, which
> implies that all my sessions are ended and hence i am forced to login once
> again!
>
> Can somebody please let me know what i am missing here, any solution to
> avoid this error...


I'm not sure this is the same I have seen, but if you redirect to another
page while the first page still has an open database connection, this may be
the result. So make sure everything is cleaned up before redirecting to
another page. Then you will not get that exception at all.

Bjorn


 
Reply With Quote
 
Arti
Guest
Posts: n/a
 
      07-16-2007
Thanks Mark, I tried that one out but it doesn't work...

Hi Bjorn,
The problem is that this problem occurs only in certain conditions... Do you
still think this solution will solve the problem?

Regards
Arti.

"Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> "Arti" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi everybody,
>>
>> I am using ASP.NET 2.0.
>>
>> When redirecting from page1 to page2 using Response.Redirect() method
>> ThreadAbortException is raised.
>>
>> In my condition sometimes even though this exception is caught and
>> handled by my code, the session_end method in global.asax is getting
>> called, which implies that all my sessions are ended and hence i am
>> forced to login once again!
>>
>> Can somebody please let me know what i am missing here, any solution to
>> avoid this error...

>
> I'm not sure this is the same I have seen, but if you redirect to another
> page while the first page still has an open database connection, this may
> be the result. So make sure everything is cleaned up before redirecting to
> another page. Then you will not get that exception at all.
>
> Bjorn
>



 
Reply With Quote
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      07-17-2007

"Arti" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks Mark, I tried that one out but it doesn't work...
>
> Hi Bjorn,
> The problem is that this problem occurs only in certain conditions... Do
> you still think this solution will solve the problem?


I don't know, depends on the details in your conditions. Let's say you
retrieve database records, and sometimes you encounter unexpected values
like dbNull where there is supposed to be a number. If this situation isn't
taken into the code, you may get an exeption that escapes the open thread.
There are all sort of possibilities in this direction, but since I don't
know anything about the app or the conditions when this happens, I am only
guessing.

Bjorn


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ending Execution without Response.end Nick Chan ASP .Net 1 10-09-2007 03:33 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
Is there any way to see why a session is ending? Big Daddy ASP .Net 2 05-08-2006 05:27 AM
how to capture onerror without ending script blocks Tobius Javascript 3 03-29-2006 05:11 AM
Can't shutdown without Ending unnamed process Bryan McCaul Computer Support 3 09-20-2004 10:08 PM



Advertisments