Is Session maintained if browser only request a graphic?

S

someone

Let's say I have a Session timeout of 20 minutes. If the browser
periodically request a graphic file, will that keep its Session alive?

What keeps the Session alive? Is it the Session cookie that is sent in the
HTTP header from the browser? If that is so, will requesting a graphic file
send the cookie?

Thanks.
 
J

Jerry

I have had a the same Problem.

The Solution is simple:

Don't use the Session Thing.

Instead always send a own ID with evry request
and store the Data for the Session in a Database (depending on the ID)
or in Memory by using a Own Class with a shared Hastable.
 
T

Tian Min Huang

Hi,

If the client browser sends HTTP request periodically, the session object
will keep alive in server side. The session object is maintained in server
side. If the request is received within time limit, the IIS will keep the
session object for the client browser.

For detailed information, please refer to "Introduction to Web Forms State
Management" topic in MSDN.

Hope this helps.

Regards,
HuangTM
This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

someone

Thanks Jerry and Tian for your answers.

My question was one of curiosity; just for the knowledge. From what I know
(I think), Session state is held because the browser sends a temporary
cookie to the server in each request. What I would like to know is whether a
browser that request an image on the server will also sends that temporary
cookie. Or is the Session cookie only sent when the browser request a .ASP
or .ASPX, .HTML, and such files, but not for .JPG, .PNG, .CSS, etc...

Now, since ASP.NET can have cookieless Session state, that means there are
other ways to keep a Session alive. Anyway, this does not really affect my
original question.

Another way I could formulate my question is: Are cookies sent when
requesting an image file, such as a .JPG file? If not, then if the only
thing that a user request are images, then after 20 minutes, the Web server
will destroy that user's session.

Thanks.
 
G

George Ter-Saakov

Apparently .NET engines keeps the session alive.

So as long as request is routed into .NEt engine the session is going to be
kept alive.
Regular images are not routed to .NET. IIS server gets the request and sends
the file. So .NET has no way to know that request was made.


Of course in case of the handler or images created dynamically aspx files
Session is kept since the request was routed to .NET

George.
 
T

Tian Min Huang

Hi,

I agree with the answer from George. I'd like to add more information. To
workaround this problem, you may consider getting image files by calling
BinaryWrite methods.

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 

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

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top