>> >I have a asp.net 2/c# web database application which works fine, but
>> > ocassionaly sesion data just dissapears. It's not any timeout as it
[quoted text clipped - 9 lines]
>>
>> When it happens, does it happen for all users at the same time...?
> No, to some it happens to some not, but always at a different time for
> each
> user.
> And nobody touches the web server at that time - no web.config changes,
> iis
> restars and similar stuff
OK, so we can eliminate the app cycling since that would affect all users at
the same time...
Do you have any code which tears down a user's session by calling
Session.Abandon(), maybe when a user logs out...? Could this be being called
unexpectedly...?

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Nedim - 25 Oct 2007 12:24 GMT
No, there is no sign out code at all, as i have very stupid users, and they
exit via closing the browser (or just shutting down the computer).
> >> >I have a asp.net 2/c# web database application which works fine, but
> >> > ocassionaly sesion data just dissapears. It's not any timeout as it
[quoted text clipped - 23 lines]
> Session.Abandon(), maybe when a user logs out...? Could this be being called
> unexpectedly...?
Mark Rae [MVP] - 25 Oct 2007 12:41 GMT
>> Do you have any code which tears down a user's session by calling
>> Session.Abandon(), maybe when a user logs out...? Could this be being
>> called
>> unexpectedly...?
> No, there is no sign out code at all, as i have very stupid users, and
> they
> exit via closing the browser (or just shutting down the computer).
Starting to run out of ideas now...
Do you have any code at all which removes and/or modifies Session variables?
Are you using Forms Authentication?
Do you receive a notification of every error?
Can you discern any pattern to this?

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Nedim - 25 Oct 2007 12:58 GMT
well so far i couldn't see any pattern. i use forms authentification, below
is the web.config snippet. i receive notification when obj ref exception
occurs, but it doesnt help much. the only place where session data is being
written is after the login, when i put all the data regarding the logged on
user in a session object. after that i retrieve that data with
object UserData = System.Web.HttpContext.Current.Session["UserData"];
web.config:
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="Login.aspx"
defaultUrl="forme/home/Default.aspx" protection="All" timeout="60"
path="/"></forms>
</authentication>
and this it the code that creates the object in session (which we use later
on as static property, Korisnik is the name of the class in app_code)
public static Korisnik Trenutni
{
get
{
object oKorisnik =
System.Web.HttpContext.Current.Session["korisnik"];
if (oKorisnik != null)
return ((Korisnik)oKorisnik);
else
return null;
}
}
> >> Do you have any code which tears down a user's session by calling
> >> Session.Abandon(), maybe when a user logs out...? Could this be being
[quoted text clipped - 14 lines]
>
> Can you discern any pattern to this?
Mark Rae [MVP] - 25 Oct 2007 13:28 GMT
> creates the object in session (which we use later on as static property
Whenever I see the words "session" and "static" in the same sentence, the
alarm bells immediately go off... :-)
Can you confirm that you are *not* creating static session variables...

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Nedim - 25 Oct 2007 19:09 GMT
The user variable is in session, the only thing is we access the object in
session through static variable.
public static Korisnik Current
{
get
{
object oKorisnik =
System.Web.HttpContext.Current.Session["korisnik"];
if (oKorisnik != null)
return ((Korisnik)oKorisnik);
else
return null;
}
}
> > creates the object in session (which we use later on as static property
>
> Whenever I see the words "session" and "static" in the same sentence, the
> alarm bells immediately go off... :-)
>
> Can you confirm that you are *not* creating static session variables...