G
Guest
I have this strange problem now twice: I am writing this relatevely large web
site on 2.0 and I made a static class, which I use for url encoding and
deconding (for remapping purposes). This static class needs the session
context to encode a url (because I stored the current language there), so I
made a static field of type HttpContext, which I refresh every reqest by
assigning the current context.
Now, every now and then I get this runtime error that the Session property
is not set (Object reference not set to instance of an object) and it's
completely random.
I suspect that it has something to do with the fact that the class is static
and GC, but I can't really figure this out.
I had the same problem in 1.1 a while ago with the same site when I wanted
to make the SqlConnection a static property and connect on Application_Start
and disconnect on Application_End. Every n-th request the SqlConnection
disappeared.
Any suggestions?
I pretty much would like to know why this things happen.
site on 2.0 and I made a static class, which I use for url encoding and
deconding (for remapping purposes). This static class needs the session
context to encode a url (because I stored the current language there), so I
made a static field of type HttpContext, which I refresh every reqest by
assigning the current context.
Now, every now and then I get this runtime error that the Session property
is not set (Object reference not set to instance of an object) and it's
completely random.
I suspect that it has something to do with the fact that the class is static
and GC, but I can't really figure this out.
I had the same problem in 1.1 a while ago with the same site when I wanted
to make the SqlConnection a static property and connect on Application_Start
and disconnect on Application_End. Every n-th request the SqlConnection
disappeared.
Any suggestions?
I pretty much would like to know why this things happen.