httphandler and session state

I

Igor K

Hi,
I'm intercepting http requests coming to my asp.net application in order to
do some additional processing of html pages.

I'm having problems to access my variables stored in Session Object, that
always has IsSessionNew = TRUE. I can not figure out why is that. I expect
to have Session access in "Public Sub ProcessRequest(ByVal context As
HttpContext)" event. Is this correct? Or maybe to early/late? Of course I'm
using IRequireSessionState or IReadOnlySessionState, however none of this
work.

From the other side, SessionID inside of this session object seems to be ok,
it coresponds to ID stored in the cookie that I see
(context.Request.Cookies("ASP.NET_SessionId"). Is there a way to 'remind'
session object that it's instance is already alive on webserver?

So far I checked my web.config, IIS settings, I was experimenting with
global.asax events, ihttpmodule... lot of energy spent with poor result.

Any help warmly welcome,

Igor
 
M

Matt Berther

Hello Igor,

As I mentioned in your previous request, you need to implement a placeholder interface:

class MyHttpHandler : IHttpHandler, IReadOnlySessionState // or IRequireSessionState if you want write access
{
public void ProcessRequest(HttpContext context)
{
string s = context.Session["SomeSessionVariable"];
}

public bools IsReusable { get { return true; } }
}
 
I

Igor Kramaric

Dear Matt,
thanks for help, but I already said that I'm using this interface, so this
does not seem to be the problem.

Any other idea (any)?

Igor

P.S. Is there anyobody out there who is really using session variables in
httphandler's ProcessRequest?


Matt Berther said:
Hello Igor,

As I mentioned in your previous request, you need to implement a
placeholder interface:

class MyHttpHandler : IHttpHandler, IReadOnlySessionState // or
IRequireSessionState if you want write access
{
public void ProcessRequest(HttpContext context)
{
string s = context.Session["SomeSessionVariable"];
}

public bools IsReusable { get { return true; } }
}

--
Matt Berther
http://www.mattberther.com
Hi,
I'm intercepting http requests coming to my asp.net application in
order to
do some additional processing of html pages.
I'm having problems to access my variables stored in Session Object,
that always has IsSessionNew = TRUE. I can not figure out why is
that. I expect to have Session access in "Public Sub
ProcessRequest(ByVal context As HttpContext)" event. Is this correct?
Or maybe to early/late? Of course I'm using IRequireSessionState or
IReadOnlySessionState, however none of this work.

From the other side, SessionID inside of this session object seems to
be ok, it coresponds to ID stored in the cookie that I see
(context.Request.Cookies("ASP.NET_SessionId"). Is there a way to
'remind' session object that it's instance is already alive on
webserver?

So far I checked my web.config, IIS settings, I was experimenting with
global.asax events, ihttpmodule... lot of energy spent with poor
result.

Any help warmly welcome,

Igor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top