HttpHandler and Session Issue

Discussion in 'ASP .Net' started by Nicolas Beunier, May 28, 2004.

  1. 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
    sessionId).

    But when i query the same webapplication (from the same local client)
    using http://<MyMachineName>/<ApplicationName>/... i get a new session
    Id on every request. Impossible to store anything into SessionState...

    To point out the problem, i created a simple test webapplication, with
    no aspx, and a single HttpHandler with IsReusable returning true.

    Note : In the web.config the cookieless sessionState's attribute is
    set to false.

    Is this some kind of bug, or am i missing something?

    Thoughts are most welcome!

    Best Regards,
    Nicolas
    Nicolas Beunier, May 28, 2004
    #1
    1. Advertising

  2. Nicolas Beunier

    bruce barker Guest

    the session key is stored in a browser cookie. browsers tie cookies to the
    site name. to the browser,

    http://localhost/myapp
    http://myhostname/myapp
    http://127.0.0.1/myapp

    are three different sites, and will each have their own set of cookies. this
    is just the way things work.


    -- bruce (sqlwork.com)


    "Nicolas Beunier" <> wrote in message
    news:...
    > 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
    > sessionId).
    >
    > But when i query the same webapplication (from the same local client)
    > using http://<MyMachineName>/<ApplicationName>/... i get a new session
    > Id on every request. Impossible to store anything into SessionState...
    >
    > To point out the problem, i created a simple test webapplication, with
    > no aspx, and a single HttpHandler with IsReusable returning true.
    >
    > Note : In the web.config the cookieless sessionState's attribute is
    > set to false.
    >
    > Is this some kind of bug, or am i missing something?
    >
    > Thoughts are most welcome!
    >
    > Best Regards,
    > Nicolas
    bruce barker, May 28, 2004
    #2
    1. Advertising

  3. Hello Bruce,

    First of all thank you for helping me!

    I think i didn't explained my problem clearly, sorry. I'll try to expose
    it a different way.

    Let's have for instance this test HttpHandler, only returning the
    current session id :

    <httpHandlers>
    <add verb="*" path="*.test"
    type="MyHttpHandler.TestHandler,MyHttpHandler" />
    </httpHandlers>

    public class TestHandler: IHttpHandler, IRequiresSessionState {
    public void ProcessRequest(HttpContext context) {
    string sessId = context.Session.SessionID;
    context.Response.ContentType = "text/xml";
    context.Response.Write(<html><body>);
    context.Response.Write("Current sessionId : "+sessId);
    context.Response.Write("<form action='sample.test'>);
    context.Response.Write("<input type='submit' value='submit'/>);
    context.Response.Write("</form>);
    context.Response.Write("</body></html>");
    context.Response.End();
    }
    public bool IsReusable { get { return true; } }
    }


    A) In the first scenario, (http://localhost/myApp/sample.test), i get
    the same sessId returned every time i submit the form (this is the
    normal behavior i guess).

    B) In the second scenario (http://myHost/myApp/sample.test), i get a new
    sessId returned every time i submit.
    It's just like no cookie is received by the client in scenario B...

    Thanks again for the help!

    Best regards,
    Nicolas

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Nicolas Beunier, May 28, 2004
    #3
  4. "Nicolas Beunier" <> wrote in message
    news:...
    > 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
    > sessionId).
    >
    > But when i query the same webapplication (from the same local client)
    > using http://<MyMachineName>/<ApplicationName>/... i get a new session
    > Id on every request. Impossible to store anything into SessionState...


    Does your machine name have an underscore character in it? There's a known
    issue with odd characters in the names of servers, and I believe this is one
    of the symptoms.
    --
    John Saunders
    johnwsaundersiii at hotmail
    John Saunders, May 29, 2004
    #4
  5. Hi John,
    Yes indeed, the machine name does have underscore in its name.
    Thank you very mutch for that info!
    I didn't know about this issue.

    I'm going to check with IP.

    Best regards,
    Nicolas
    Nicolas Beunier, May 31, 2004
    #5
    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. Igor K
    Replies:
    4
    Views:
    651
    Matt Berther
    Sep 24, 2004
  2. Igor K

    httphandler and session state

    Igor K, Sep 24, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    5,367
    Igor Kramaric
    Sep 26, 2004
  3. Michael Schwarz

    cookieless Session and httpHandler configuration

    Michael Schwarz, Apr 4, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,220
    Steven Cheng[MSFT]
    Apr 5, 2006
  4. =?Utf-8?B?QnVydA==?=

    IE7 and window.open issue to HttpHandler for downloads

    =?Utf-8?B?QnVydA==?=, May 2, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    3,480
    leandro.almeida
    Jul 15, 2009
  5. =?Utf-8?B?SmVk?=

    IE7 Session and HttpHandler

    =?Utf-8?B?SmVk?=, Sep 17, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    703
    =?Utf-8?B?SmVk?=
    Sep 19, 2007
Loading...

Share This Page