469,627 Members | 1,104 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,627 developers. It's quick & easy.

HttpHandlers and Session access

Hi group, I read a lot about this problem and all the same answers
appears...Implement the IRequireSessionState or IReadOnlySessionState
interface...but the same problem arrays'...null session.

Anyone have a solution for this problem?. I'm on the GetHandler methods
inside my custom Hander!. Please group, people...and Good I' Ned your
help :P

Regards and Thanks!

May 16 '06 #1
3 1463
I use System.Web.SessionState.IRequiresSessionState and it works, no
implementation necessary.

SA

<da******************@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
Hi group, I read a lot about this problem and all the same answers
appears...Implement the IRequireSessionState or IReadOnlySessionState
interface...but the same problem arrays'...null session.

Anyone have a solution for this problem?. I'm on the GetHandler methods
inside my custom Hander!. Please group, people...and Good I' Ned your
help :P

Regards and Thanks!

May 16 '06 #2
Tanks for your reply, can you send me an example code?. Maybe I'm doing
something wrong.

This is my actual no working code :(

internal class CustomHandler: IHttpHandlerFactory,
IRequiresSessionState
{
public CustomHandler()
{

}

#region IHttpHandlerFactory Members

public void ReleaseHandler(IHttpHandler handler)
{

}

public IHttpHandler GetHandler(HttpContext context, string requestType,
string url, string pathTranslated)
{
Page compiledPage;

compiledPage =
PageParser.GetCompiledPageInstance(url,pathTransla ted, context) as
Page;

HttpContext.Current.Session["myId"] --> null. The entired
Session object is null

--------------------------------------------------------------------------------------

Thanks!

Damian.

May 18 '06 #3
I only implement IHttpHandler and not IHttpHandlerFactory

then I use

HttpContext.Current.Session.Add("imgVal", imgVal)

This is in VB...

Public Class imageservice
Implements IHttpHandler
Implements System.Web.SessionState.IRequiresSessionState

Public Overridable ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return True
End Get
End Property
Public Overridable Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim oPic As Byte()
Dim imgVal As String
Try
.....
HttpContext.Current.Session.Add("imgVal", imgVal)
HttpContext.Current.Response.ContentType = "image/jpeg"
HttpContext.Current.Response.OutputStream.Write(.. .., 0, oPic.Length)
Catch ex As Exception
ExceptionManager.Publish(ex)
Throw ex
End Try
End Sub
..... any other private Subs here

Hope that helps

SA



<da******************@gmail.com> wrote in message news:11**********************@g10g2000cwb.googlegr oups.com...
Tanks for your reply, can you send me an example code?. Maybe I'm doing
something wrong.

This is my actual no working code :(

internal class CustomHandler: IHttpHandlerFactory,
IRequiresSessionState
{
public CustomHandler()
{

}

#region IHttpHandlerFactory Members

public void ReleaseHandler(IHttpHandler handler)
{

}

public IHttpHandler GetHandler(HttpContext context, string requestType,
string url, string pathTranslated)
{
Page compiledPage;

compiledPage =
PageParser.GetCompiledPageInstance(url,pathTransla ted, context) as
Page;

HttpContext.Current.Session["myId"] --> null. The entired
Session object is null

--------------------------------------------------------------------------------------

Thanks!

Damian.

May 18 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by some guy with a computer | last post: by
reply views Thread by Chance Hopkins | last post: by
1 post views Thread by Patrick Kristiansen | last post: by
2 posts views Thread by Prince | last post: by
4 posts views Thread by Grant Harmeyer | last post: by
4 posts views Thread by Jan Kucera | last post: by
5 posts views Thread by Anonieko | last post: by
2 posts views Thread by Fernando Rodriguez | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.