473,508 Members | 4,179 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpHandler and Session Issue

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
Nov 18 '05 #1
4 3830
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" <nb*@lincoln.fr> wrote in message
news:58**************************@posting.google.c om...
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

Nov 18 '05 #2
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!
Nov 18 '05 #3
"Nicolas Beunier" <nb*@lincoln.fr> wrote in message
news:58**************************@posting.google.c om...
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
Nov 18 '05 #4
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
Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4227
by: Igor K | last post by:
Hi all, I'm developing asp.net website. Most of the pages are aspx, but let's say, some 10% are html. For this html pages i use httphandlers to intercept calls and to perform some job on this...
4
5019
by: Jeremy Lew | last post by:
When my HttpHandler is processing a request when installed on a particular 2003 Server machine, the Context.Session object is null. Any idea why this might be? My handler implements...
3
1772
by: Ralf Müller | last post by:
hi all! in my custom HttpHandler HttpContext.Current.Session is not set - why? greetings, ralf
5
1591
by: the4man | last post by:
Hi all! I have an app that show images that are stored in SQL Server. To show the images on screen, until now (with the "old" ASP), I use the following code: <img src="showimage.asp?id=20"...
3
2156
by: Michael Schwarz | last post by:
Hi, I have a own HttpHandler running and configured like this in my web.config: <add verb="*" path="subfolder/*.ashx" type="Class,Assembly"/> Now, when turning cookieless Sessions on my...
7
2670
by: Ty | last post by:
Hi, All- I have a custom httphandler that outputs an image to the browser based upon some user input. I'd like to be able to store information about that image in session and have them...
0
1217
by: uraanu | last post by:
I am having an issue with sessions and httphandlers. I have some tracking information that I am passing in my url as folders (ie: www.mysite.com/info1/44/info2/55/mypage.aspx) which I am capturing...
2
1519
by: Alan Samet | last post by:
I have a performance issue related to HttpHandlers. I've written a photo gallery application that uses HttpHandlers to manage a virtual URL to my thumbnails. When I render the document with the...
5
4307
by: zlf | last post by:
Hello, I try to use a custom HttpHandler to add something to session, then display the original page. public void ProcessRequest(HttpContext context) { context.Session = "test"; } But, a...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7128
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.