IHttpHandlerFactory and problem with Session

Discussion in 'ASP .Net' started by =?Utf-8?B?QmFydG9zeiBLcnp5d2lja2k=?=, Jun 18, 2004.

  1. I have the problem with Session object witch is null, when I implement IHttpHandlerFactory. Implementing IRequiresSessionState interface doesn't help.
    My code is like this:

    class MyController : IHttpHandlerFactory, System.Web.SessionState.IRequiresSessionState {
    public virtual IHttpHandler GetHandler (HttpContext context, string requestType, string url, string path) {
    //some stuff here
    context.Session["aaa"] = "aaa"; // here Session object is null
    return System.Web.UI.PageParser.GetCompiledPageInstance (url, "SomePage.aspx", context);
    }
    //...
    }

    How can I access the session object ? Please help !
     
    =?Utf-8?B?QmFydG9zeiBLcnp5d2lja2k=?=, Jun 18, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?QmFydG9zeiBLcnp5d2lja2k=?=

    Natty Gur Guest

    Hi,

    It might be your first call and session isn't build in the server yet.

    Natty Gur[MVP]

    blog : http://weblogs.asp.net/ngur
    Mobile: +972-(0)52-8888377


    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, Jun 18, 2004
    #2
    1. Advertising

  3. > It might be your first call and session isn't build in the server yet.
    > ...


    No. A the first time the login page is requested.
    I was debugging the application, and in the global.asax in the Session_Start event i wrote sth like this:
    protected void Session_Start(Object sender, EventArgs e) {
    Session["test"] = "aaa";
    }
    And here is OK, Session object is enable.
    After that IHttpHandlerFactory is called and here Session object is null.

    Any ideas ?
     
    =?Utf-8?B?QmFydG9zeiBLcnp5d2lja2k=?=, Jun 18, 2004
    #3
  4. =?Utf-8?B?QmFydG9zeiBLcnp5d2lja2k=?=

    Natty Gur Guest

    first of all just for your knowledge:
    I cant describe all request life cycle but
    1) context object create by HttpRuntime.ProcessRequestInternal.

    2) Session is implement as Module and get called by HttpApplication
    InitModules. HttpApplication set application context to session just if
    session ID already exist as cookie or embedded in URL (cookieless).

    3) just then application ResumeSteps and call IHttpHandlerFactory from
    MapHandlerExecutionStep.

    Session_Start fired when SessionStateModule create new session on your
    first call. but context still don't have reference to session on
    IHttpHandlerFactory.

    Natty Gur[MVP]

    blog : http://weblogs.asp.net/ngur
    Mobile: +972-(0)52-8888377


    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Natty Gur, Jun 19, 2004
    #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. =?Utf-8?B?QmFydG9zeiBLcnp5d2lja2k=?=

    IHttpHandlerFactory and Session problem !

    =?Utf-8?B?QmFydG9zeiBLcnp5d2lja2k=?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    577
    Vadim Chekan
    Jul 1, 2004
  2. AndyE

    IHttpHandlerFactory registration

    AndyE, Apr 6, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    663
    AndyE
    Apr 8, 2005
  3. Netveloper

    URL Rewriting using IHttpHandlerFactory

    Netveloper, Jun 8, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    766
    Netveloper
    Jun 8, 2005
  4. Steve B.

    IIS 7 and IHttpHandlerFactory

    Steve B., May 25, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    470
    Steve B.
    May 25, 2007
  5. Steven Voordijk

    IHttpHandlerFactory and file upload

    Steven Voordijk, Oct 30, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    340
    Steven Voordijk
    Oct 31, 2007
Loading...

Share This Page