开发者

asp.net session dissappers

开发者 https://www.devze.com 2023-02-20 00:50 出处:网络
I have a strange problem: I have a site which has an administration system. In the system there is a way to edit my inputs. To make this easier, I can search for their ids to find them.

I have a strange problem: I have a site which has an administration system.

In the system there is a way to edit my inputs. To make this easier, I can search for their ids to find them.

The problem is when the page posts back the session variable I hold the "logged in" value in, becomes nothing.. and i get kicked out. Why is that happening? Session variables should hold at least 20 minutes if anything else is stated?

EDIT: It works for a coworker, but not for me.. Also, it only does it on certain inputs.

EDIT2: Turns out i get an exception. but it doesnt say what, only says "property evaluation failed". i get it on this code row:

Response.Redirect("./admin.aspx?search=" + u.FirstOrDefault.ProductID.ToString, False)

And sience it goes through this statement, its not because it is an objectreference not set to an 开发者_JAVA百科instance of an object

If u.Any Then


If you experience an exception your session might be restarted. Create a global.asax and set breakpoints to the Application_Error, Session_End and Session_Start events to track down the issue

Edit based on your update: Make sure that u.Count == 1, because FirstOrDefault will throw an exception, if the count is > 1.

Have a look at this link http://support.microsoft.com/kb/312629/EN-US/ which should cover your original problem http://forums.asp.net/t/1296202.aspx/1


If you have Web Garden enabled (multiple worker processes for an application pool) this can explain such behavior - been there.

Either have one worker process for the pool, or switch to Database driven Session.


Do you have cookies enabled? If not, this would explain this behavior. Especially as you state it works for the co-worker, you can deduce it's a client-side issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消