I just recently came across the same issue but cant say exactly wat u looking is really i am going to answer, i read it somewhere that managed and unmanaged resources in asp.net handles session differently, means there is an interface named IRequireSessionState
which is been implemented in managed resource and in unmanaged resources like pictures...etc they dont come into it caz as the microsoft guy was saying that these static(unmanaged) resources can be put directly onto the server or it can be saved in any format
across the request(i really didnt get it how to save it in during request but anywys.....[:)] ) i came up wiv a solution , infact i was into some kind of multiple login stuff and how to prevent it i came across some good stuff which was using cache object
to make up a key and try to chk that cache before letting u in the application ...... and there were some pages and user controls where i was using pictures and some resources......etc and whenever i try to access the unmanaged resource it always throws this
erorr session state context is not available in present context.... blah blah....
So i come up with the solution which took lil bit time but it was worth a while to search for it.....I normally belief in piece of code will really helps the developer community caz there is always a communication gap and piece of code can really lesser
this gap.... if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState)
{
Exception lastException = Server.GetLastError;
if (!((lastException == null))) {
Session("ErrorStack") = lastException.StackTrace;
Session("ErrorSource") = lastException.Source;
Session("ErrorMessage") = lastException.Message;
} else {
if (!((Session("AnyName") == null))) {
ClassName up;
up = Session("AnyName");
string sKey = ((string)(up.UserID));
string sUser = ((string)(HttpContext.Current.Cache(sKey)));
}
}
}
It was in global.asax page and i did find a way to ignore the unmanaged resource by simply chking that if present context handler is implementing or is type of
IRequiresSessionState and IReadOnlySessionState simply ignore them, this way i did resolve my issue....
Again i cant exactly say that how it can be really helpful to u but as all pattern are have baked... u have to figure out how it can help u.
coolrah
Member
4 Points
3 Posts
Re: SessionState in HttpModule problem (2.0)
Apr 22, 2007 05:56 AM|LINK
Hi Tomasz,
I just recently came across the same issue but cant say exactly wat u looking is really i am going to answer, i read it somewhere that managed and unmanaged resources in asp.net handles session differently, means there is an interface named IRequireSessionState which is been implemented in managed resource and in unmanaged resources like pictures...etc they dont come into it caz as the microsoft guy was saying that these static(unmanaged) resources can be put directly onto the server or it can be saved in any format across the request(i really didnt get it how to save it in during request but anywys.....[:)] ) i came up wiv a solution , infact i was into some kind of multiple login stuff and how to prevent it i came across some good stuff which was using cache object to make up a key and try to chk that cache before letting u in the application ...... and there were some pages and user controls where i was using pictures and some resources......etc and whenever i try to access the unmanaged resource it always throws this erorr session state context is not available in present context.... blah blah....
So i come up with the solution which took lil bit time but it was worth a while to search for it.....I normally belief in piece of code will really helps the developer community caz there is always a communication gap and piece of code can really lesser this gap....
if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState){
Exception lastException = Server.GetLastError;
if (!((lastException == null))) {
Session("ErrorStack") = lastException.StackTrace;
Session("ErrorSource") = lastException.Source;
Session("ErrorMessage") = lastException.Message;
} else {
if (!((Session("AnyName") == null))) {
ClassName up;
up = Session("
AnyName");string sKey = ((string)(up.UserID));
string sUser = ((string)(HttpContext.Current.Cache(sKey)));
}
}
}
It was in global.asax page and i did find a way to ignore the unmanaged resource by simply chking that if present context handler is implementing or is type ofIRequiresSessionState andIReadOnlySessionState simply ignore them, this way i did resolve my issue....Again i cant exactly say that how it can be really helpful to u but as all pattern are have baked... u have to figure out how it can help u.RegardsRahmanSession State httpcontext Seession Session_End HttpModule