HttpHandler and Session Issue

N

Nicolas Beunier

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
 
N

Nicolas Beunier

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
 
J

John Saunders

Nicolas Beunier said:
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.
 
N

Nicolas Beunier

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top