Home > Archive > ASP .NET > May 2004 > HttpHandler and Session Issue
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
HttpHandler and Session Issue
|
|
| Nicolas Beunier 2004-05-28, 7:39 am |
| 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 2004-05-28, 2:41 pm |
| 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" <nbe@lincoln.fr> wrote in message
news:581e128a.0405280231.482572db@posting.google.com...
> 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 2004-05-28, 4:40 pm |
| 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!
| |
| John Saunders 2004-05-29, 3:39 pm |
| "Nicolas Beunier" <nbe@lincoln.fr> wrote in message
news:581e128a.0405280231.482572db@posting.google.com...
> 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
| |
| Nicolas Beunier 2004-05-31, 9:48 am |
| 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
|
|
|
|
|