Board index » Web Programming » Session object is NULL in HTTP handler

Session object is NULL in HTTP handler

Web Programming279
Hi,



I have written a simple HTTP handler (inherited IHttpHandler) to handle

requests for specific extensions. Basically it works. However when trying to

access the context.Session object inside the "public void

ProcessRequest(HttpContext context)" method, it seems to be null reference

(context.Session is not a valid object). There are no problems with other

objects like context.Application or context.Request etc.



Other regular aspx pages in the same application have no problems at all

accessing the Session object. The problem is only when trying to access it

through the context object in an HTTP handler written from scratch.



- Is it a bug?

- Did I miss some important detail?



Additional info:

Windows Server 2003 + all updates

.NET framework 1.1





--

Thanks

Eric


-
 

Re:Session object is NULL in HTTP handler

Try to implement the IRequiresSessionState interface...this is a marker

interface so you don't need to implement anything:



http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/library/en-us/cpref/html/frlrfsystemwebsessionstateirequiressessionstateclasstopic.asp



not 100% sure though



--

MY ASP.Net tutorials

www.openmymind.net/">www.openmymind.net/





"Eric Dan" <nospam@stopspamming.com>wrote in message

Quote
Hi,



I have written a simple HTTP handler (inherited IHttpHandler) to handle

requests for specific extensions. Basically it works. However when trying

to

access the context.Session object inside the "public void

ProcessRequest(HttpContext context)" method, it seems to be null reference

(context.Session is not a valid object). There are no problems with other

objects like context.Application or context.Request etc.



Other regular aspx pages in the same application have no problems at all

accessing the Session object. The problem is only when trying to access it

through the context object in an HTTP handler written from scratch.



- Is it a bug?

- Did I miss some important detail?



Additional info:

Windows Server 2003 + all updates

.NET framework 1.1





--

Thanks

Eric





-

Re:Session object is NULL in HTTP handler

Thanks a lot Karl. This definitely solved my problem.

Eric





"Karl Seguin" wrote:



Quote
Try to implement the IRequiresSessionState interface...this is a marker

interface so you don't need to implement anything:



http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/library/en-us/cpref/html/frlrfsystemwebsessionstateirequiressessionstateclasstopic.asp



not 100% sure though



--

MY ASP.Net tutorials

www.openmymind.net/">www.openmymind.net/





"Eric Dan" <nospam@stopspamming.com>wrote in message

news:D2FB9C6E-6E33-4BCB-BDE2-DB1DDBAF9D78@microsoft.com...

>Hi,

>

>I have written a simple HTTP handler (inherited IHttpHandler) to handle

>requests for specific extensions. Basically it works. However when trying

to

>access the context.Session object inside the "public void

>ProcessRequest(HttpContext context)" method, it seems to be null reference

>(context.Session is not a valid object). There are no problems with other

>objects like context.Application or context.Request etc.

>

>Other regular aspx pages in the same application have no problems at all

>accessing the Session object. The problem is only when trying to access it

>through the context object in an HTTP handler written from scratch.

>

>- Is it a bug?

>- Did I miss some important detail?

>

>Additional info:

>Windows Server 2003 + all updates

>.NET framework 1.1

>

>

>--

>Thanks

>Eric







-