context.Session is null

Discussion in 'ASP .Net' started by =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Jul 16, 2006.

  1. Hi;

    I have a page that is created from a class using:
    <httpHandlers>
    <add verb="*" path="report-create.aspx" type="ReportCreate"/>
    </httpHandlers>

    and the code is:
    public class ReportCreate : IHttpHandler
    {
    public void ProcessRequest(HttpContext context)
    {
    ....

    The problem is that context.Session is null as is
    HttpContext.Current.Session - how do I get the session object?

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com
    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Jul 16, 2006
    #1
    1. Advertising

  2. Implement IRequiresSessionState interface.

    http://msdn2.microsoft.com/en-us/library/system.web.sessionstate.irequiressessionstate.aspx

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




    "David Thielen" wrote:

    > Hi;
    >
    > I have a page that is created from a class using:
    > <httpHandlers>
    > <add verb="*" path="report-create.aspx" type="ReportCreate"/>
    > </httpHandlers>
    >
    > and the code is:
    > public class ReportCreate : IHttpHandler
    > {
    > public void ProcessRequest(HttpContext context)
    > {
    > ...
    >
    > The problem is that context.Session is null as is
    > HttpContext.Current.Session - how do I get the session object?
    >
    > --
    > thanks - dave
    > david_at_windward_dot_net
    > http://www.windwardreports.com
    >
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Jul 16, 2006
    #2
    1. Advertising

  3. THANK YOU!

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com



    "Peter Bromberg [C# MVP]" wrote:

    > Implement IRequiresSessionState interface.
    >
    > http://msdn2.microsoft.com/en-us/library/system.web.sessionstate.irequiressessionstate.aspx
    >
    > Peter
    > --
    > Co-founder, Eggheadcafe.com developer portal:
    > http://www.eggheadcafe.com
    > UnBlog:
    > http://petesbloggerama.blogspot.com
    >
    >
    >
    >
    > "David Thielen" wrote:
    >
    > > Hi;
    > >
    > > I have a page that is created from a class using:
    > > <httpHandlers>
    > > <add verb="*" path="report-create.aspx" type="ReportCreate"/>
    > > </httpHandlers>
    > >
    > > and the code is:
    > > public class ReportCreate : IHttpHandler
    > > {
    > > public void ProcessRequest(HttpContext context)
    > > {
    > > ...
    > >
    > > The problem is that context.Session is null as is
    > > HttpContext.Current.Session - how do I get the session object?
    > >
    > > --
    > > thanks - dave
    > > david_at_windward_dot_net
    > > http://www.windwardreports.com
    > >
    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Jul 16, 2006
    #3
  4. =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=

    navyjax2

    Joined:
    Sep 20, 2008
    Messages:
    11
    So what did you really do?

    The code at the link says you test the state of Context.Handler:

    Code:
            bool requiresSession = false;
    
            if (Context.Handler is IRequiresSessionState)
                requiresSession = true;
    So how do you get Context.Handler not to be null/to require Session State? I have this issue where my extra .cs files can't get the values of the Session variables I created and stored values to in Default.aspx.cs just fine.

    -Tom
    navyjax2, May 1, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roger Stavcode
    Replies:
    0
    Views:
    425
    Roger Stavcode
    Jan 11, 2004
  2. Roger Stavcode
    Replies:
    1
    Views:
    432
    Alvin Bruney
    Jan 17, 2004
  3. Replies:
    1
    Views:
    8,517
    Teemu Keiski
    Jan 22, 2004
  4. Replies:
    5
    Views:
    26,598
    Mike Schilling
    Mar 29, 2006
  5. asd
    Replies:
    1
    Views:
    432
    www.pulpjava.com
    Nov 9, 2006
Loading...

Share This Page