473,320 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

httphandler session scope

Ty
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

Jul 27 '06 #1
7 2663
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

Jul 27 '06 #2
Ty
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
Jul 27 '06 #3
Ty
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...

Jul 27 '06 #4

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:46**********************************@microsof t.com...

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

Jul 27 '06 #5
Ty
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]" <pb*******@yahoo.nospammin.comwrote in message
news:46**********************************@microsof t.com...

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

Jul 27 '06 #6
Ty
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]" <pb*******@yahoo.nospammin.comwrote in message
news:46**********************************@microsof t.com...

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
>>
>>
Jul 27 '06 #7
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
>
>

Jul 27 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nicolas Beunier | last post by:
Hi! I am currently working on a Web Application using some HttpHandlers. As i need to read/update objects stored in session, each Handler implements the IRequestSessionState interface. When...
4
by: Igor K | last post by:
Hi all, I'm developing asp.net website. Most of the pages are aspx, but let's say, some 10% are html. For this html pages i use httphandlers to intercept calls and to perform some job on this...
2
by: Igor K | last post by:
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,...
4
by: Jeremy Lew | last post by:
When my HttpHandler is processing a request when installed on a particular 2003 Server machine, the Context.Session object is null. Any idea why this might be? My handler implements...
2
by: rpale | last post by:
We want to create server-side code that will retrieve the user requested pages, then manipulate the content of those pages just before being sent back to the user. We tried the following: ...
3
by: Ralf Müller | last post by:
hi all! in my custom HttpHandler HttpContext.Current.Session is not set - why? greetings, ralf
5
by: the4man | last post by:
Hi all! I have an app that show images that are stored in SQL Server. To show the images on screen, until now (with the "old" ASP), I use the following code: <img src="showimage.asp?id=20"...
3
by: Michael Schwarz | last post by:
Hi, I have a own HttpHandler running and configured like this in my web.config: <add verb="*" path="subfolder/*.ashx" type="Class,Assembly"/> Now, when turning cookieless Sessions on my...
5
by: zlf | last post by:
Hello, I try to use a custom HttpHandler to add something to session, then display the original page. public void ProcessRequest(HttpContext context) { context.Session = "test"; } But, a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.