Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > httphandler session scope

Reply
Thread Tools

httphandler session scope

 
 
Ty
Guest
Posts: n/a
 
      07-27-2006
Hi, All-

I have a custom httphandler that outputs an image to the browser based
upon some user input. I'd like to be able to store information about
that image in session and have them accessible to all aspx pages in my
project. Session state seems to be working normally in my handler,
however, the session variables are not accessible anywhere outside the
handler itself. Any ideas?


Thanks in advance
Ty

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      07-27-2006
Your handler implements IRequiresSessionState?


--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Ty" wrote:

> Hi, All-
>
> I have a custom httphandler that outputs an image to the browser based
> upon some user input. I'd like to be able to store information about
> that image in session and have them accessible to all aspx pages in my
> project. Session state seems to be working normally in my handler,
> however, the session variables are not accessible anywhere outside the
> handler itself. Any ideas?
>
>
> Thanks in advance
> Ty
>
>

 
Reply With Quote
 
 
 
 
Ty
Guest
Posts: n/a
 
      07-27-2006
Hi, Peter-

First off, thanks for responding. As to your question, yes, and
session is working perfectly within the handler itself. I have gotten
a bit further with this problem...in my global.asax file's
Session_Start event I have the following:

HttpContext ctx = HttpContext.Current;
MapEngineHttpHandler.DTMapEngineHandler mapHandler = new
MapEngineHttpHandler.DTMapEngineHandler();
mapHandler.ProcessRequest(ctx);
Session["NewSessionVariable"]= ctx.Session["SessionID"];

So I am able to retrieve the SessionID session variable that I created
in the Handler, but I am not able to retrieve the value of
Session["NewSessionVariable"] on any other pages. SessionState mode is
currently InProc....

Thanks
Ty

Peter wrote:
> Your handler implements IRequiresSessionState?
>
>
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
>
>
> "Ty" wrote:
>
> > Hi, All-
> >
> > I have a custom httphandler that outputs an image to the browser based
> > upon some user input. I'd like to be able to store information about
> > that image in session and have them accessible to all aspx pages in my
> > project. Session state seems to be working normally in my handler,
> > however, the session variables are not accessible anywhere outside the
> > handler itself. Any ideas?
> >
> >
> > Thanks in advance
> > Ty
> >
> >


 
Reply With Quote
 
Ty
Guest
Posts: n/a
 
      07-27-2006
I should probably also let you know that my goal here is to somehow
wire up the HttpHandler such that session variables that are modified
in the handler during run-time are also available to all other pages
during run-time, not just when session starts...

 
Reply With Quote
 
tdavisjr
Guest
Posts: n/a
 
      07-27-2006

"Peter Bromberg [C# MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

I'm not sure why you would have to implement this interface for a
HttpHandler, since the System.Web.UI.Page object don't even implement this
interface, yet you can access session state from aspx pages. I know you
have to implement this if doing a custom module if you want to access
session state.


> Your handler implements IRequiresSessionState?
>
>
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
>
>
> "Ty" wrote:
>
>> Hi, All-
>>
>> I have a custom httphandler that outputs an image to the browser based
>> upon some user input. I'd like to be able to store information about
>> that image in session and have them accessible to all aspx pages in my
>> project. Session state seems to be working normally in my handler,
>> however, the session variables are not accessible anywhere outside the
>> handler itself. Any ideas?
>>
>>
>> Thanks in advance
>> Ty
>>
>>

 
Reply With Quote
 
Ty
Guest
Posts: n/a
 
      07-27-2006
Perhaps I'm not being clear....I definitely need to access session from
within my custom handler, which is why I implemented the
irequiresessionstate interface. I have an object in my handler, which
is unique to the session, that I need to access in higher-level pages
such as asp and aspx pages. Users should not be able to share this
object as it changes based on user input, so we store it in session in
the handler itself. Now say I need access to that session
variable(which holds the object) elsewhere in my web app...how would
one go about doing this?

tdavisjr wrote:
> "Peter Bromberg [C# MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> I'm not sure why you would have to implement this interface for a
> HttpHandler, since the System.Web.UI.Page object don't even implement this
> interface, yet you can access session state from aspx pages. I know you
> have to implement this if doing a custom module if you want to access
> session state.
>
>
> > Your handler implements IRequiresSessionState?
> >
> >
> > --
> > Co-founder, Eggheadcafe.com developer portal:
> > http://www.eggheadcafe.com
> > UnBlog:
> > http://petesbloggerama.blogspot.com
> >
> >
> >
> >
> > "Ty" wrote:
> >
> >> Hi, All-
> >>
> >> I have a custom httphandler that outputs an image to the browser based
> >> upon some user input. I'd like to be able to store information about
> >> that image in session and have them accessible to all aspx pages in my
> >> project. Session state seems to be working normally in my handler,
> >> however, the session variables are not accessible anywhere outside the
> >> handler itself. Any ideas?
> >>
> >>
> >> Thanks in advance
> >> Ty
> >>
> >>


 
Reply With Quote
 
Ty
Guest
Posts: n/a
 
      07-27-2006
After some more testing I've found that getting at the session
variables created in the handler is obviously very easy from aspx
code-behinds, but my test scenario involves a few classic asp pages.
This is where my problem lies as asp and asp.net are not running under
the same process & won't be able to share session data. Thanks to all
who replied.

Ty wrote:
> Perhaps I'm not being clear....I definitely need to access session from
> within my custom handler, which is why I implemented the
> irequiresessionstate interface. I have an object in my handler, which
> is unique to the session, that I need to access in higher-level pages
> such as asp and aspx pages. Users should not be able to share this
> object as it changes based on user input, so we store it in session in
> the handler itself. Now say I need access to that session
> variable(which holds the object) elsewhere in my web app...how would
> one go about doing this?
>
> tdavisjr wrote:
> > "Peter Bromberg [C# MVP]" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >
> > I'm not sure why you would have to implement this interface for a
> > HttpHandler, since the System.Web.UI.Page object don't even implement this
> > interface, yet you can access session state from aspx pages. I know you
> > have to implement this if doing a custom module if you want to access
> > session state.
> >
> >
> > > Your handler implements IRequiresSessionState?
> > >
> > >
> > > --
> > > Co-founder, Eggheadcafe.com developer portal:
> > > http://www.eggheadcafe.com
> > > UnBlog:
> > > http://petesbloggerama.blogspot.com
> > >
> > >
> > >
> > >
> > > "Ty" wrote:
> > >
> > >> Hi, All-
> > >>
> > >> I have a custom httphandler that outputs an image to the browser based
> > >> upon some user input. I'd like to be able to store information about
> > >> that image in session and have them accessible to all aspx pages in my
> > >> project. Session state seems to be working normally in my handler,
> > >> however, the session variables are not accessible anywhere outside the
> > >> handler itself. Any ideas?
> > >>
> > >>
> > >> Thanks in advance
> > >> Ty
> > >>
> > >>


 
Reply With Quote
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      07-27-2006
Ty,
In ASP.NET 2.0, your Session doesn't become live until an object has
actually been added to Session State. So most likely your Session_Start
handler isn't even being fired. Move the code out of the Session_Start event
handler.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Ty" wrote:

> Hi, Peter-
>
> First off, thanks for responding. As to your question, yes, and
> session is working perfectly within the handler itself. I have gotten
> a bit further with this problem...in my global.asax file's
> Session_Start event I have the following:
>
> HttpContext ctx = HttpContext.Current;
> MapEngineHttpHandler.DTMapEngineHandler mapHandler = new
> MapEngineHttpHandler.DTMapEngineHandler();
> mapHandler.ProcessRequest(ctx);
> Session["NewSessionVariable"]= ctx.Session["SessionID"];
>
> So I am able to retrieve the SessionID session variable that I created
> in the Handler, but I am not able to retrieve the value of
> Session["NewSessionVariable"] on any other pages. SessionState mode is
> currently InProc....
>
> Thanks
> Ty
>
> Peter wrote:
> > Your handler implements IRequiresSessionState?
> >
> >
> > --
> > Co-founder, Eggheadcafe.com developer portal:
> > http://www.eggheadcafe.com
> > UnBlog:
> > http://petesbloggerama.blogspot.com
> >
> >
> >
> >
> > "Ty" wrote:
> >
> > > Hi, All-
> > >
> > > I have a custom httphandler that outputs an image to the browser based
> > > upon some user input. I'd like to be able to store information about
> > > that image in session and have them accessible to all aspx pages in my
> > > project. Session state seems to be working normally in my handler,
> > > however, the session variables are not accessible anywhere outside the
> > > handler itself. Any ideas?
> > >
> > >
> > > Thanks in advance
> > > Ty
> > >
> > >

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cookieless Session and httpHandler configuration Michael Schwarz ASP .Net 3 04-05-2006 09:41 AM
null Session object in HttpHandler Jeremy Lew ASP .Net 4 10-11-2004 04:47 PM
httphandler and session state Igor K ASP .Net 2 09-26-2004 09:32 PM
Httphandler and session problem with html pages Igor K ASP .Net 4 09-24-2004 06:02 PM
HttpHandler and Session Issue Nicolas Beunier ASP .Net 4 05-31-2004 01:05 PM



Advertisments