473,662 Members | 2,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2678
Your handler implements IRequiresSessio nState?
--
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.Cur rent;
MapEngineHttpHa ndler.DTMapEngi neHandler mapHandler = new
MapEngineHttpHa ndler.DTMapEngi neHandler();
mapHandler.Proc essRequest(ctx) ;
Session["NewSessionVari able"]= 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["NewSessionVari able"] on any other pages. SessionState mode is
currently InProc....

Thanks
Ty

Peter wrote:
Your handler implements IRequiresSessio nState?
--
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*******@yaho o.nospammin.com wrote in message
news:46******** *************** ***********@mic rosoft.com...

I'm not sure why you would have to implement this interface for a
HttpHandler, since the System.Web.UI.P age 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 IRequiresSessio nState?
--
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
irequiresession state 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*******@yaho o.nospammin.com wrote in message
news:46******** *************** ***********@mic rosoft.com...

I'm not sure why you would have to implement this interface for a
HttpHandler, since the System.Web.UI.P age 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 IRequiresSessio nState?
--
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
irequiresession state 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*******@yaho o.nospammin.com wrote in message
news:46******** *************** ***********@mic rosoft.com...

I'm not sure why you would have to implement this interface for a
HttpHandler, since the System.Web.UI.P age 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 IRequiresSessio nState?
>
>
--
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.Cur rent;
MapEngineHttpHa ndler.DTMapEngi neHandler mapHandler = new
MapEngineHttpHa ndler.DTMapEngi neHandler();
mapHandler.Proc essRequest(ctx) ;
Session["NewSessionVari able"]= 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["NewSessionVari able"] on any other pages. SessionState mode is
currently InProc....

Thanks
Ty

Peter wrote:
Your handler implements IRequiresSessio nState?
--
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
3838
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 requesting the webapplication using urls like http://localhost/<ApplicationName>/... everything works fine. A new session is created, and reused on every following requests (same
4
4234
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 pages. Lately I need to access Session state in HttpHandler's code. This seems to be the problem. I searched the internet for some solution, i always found advice to dervie from IHttpHandler and that will do, but obivously not.
2
2539
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, 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...
4
5034
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 IRequiresSessionState and works normally on other machines. Thanks, Jeremy
2
2140
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: • User requests the page, call it http://www.test.com/testapp/test.aspx • IIS receives the request • HttpHandler is called for all .aspx files requested as defined in the web.config file for this application <httpHandlers> <add verb="*"...
3
1776
by: Ralf Müller | last post by:
hi all! in my custom HttpHandler HttpContext.Current.Session is not set - why? greetings, ralf
5
1597
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" /> And in "showimage.asp" (more or less, I write from memory)
3
2158
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 HttpHandler is not working, instead my second HttpHandler is invoked, which is configured for *.ashx files.
5
4311
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 empty page is rendered with this HttpHandler, should I add some
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.