TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
srikanth
NA
5
0
How to avoid Connection: close when Response.StatusCode = 304 is set
Jun 26 2009 4:24 AM
I am trying to improve site (developed on ASP.NET/IIS6.0) performance by reducing network traffic between client & server, by setting expiration for static files(js, jpg, gif, css etc) so that I can avoid 304 responses from server.
For that I have written a http module, in begin request event I am trying to set the expires header for the file, so that I can avoid further requests from client.
private
void
BeginRequest(
object
sender,
EventArgs
e){
HttpContext
.Current.Response.Expires = 15;}
Everything seem to be working fine, but when the set expiration date is crossed (expired), further requests I am seeing that the content is downloded again. Which I dont want to do that way, because there is no change in the modified date.
So for that, I tried to explicitly set the response.code to 304.
if
(
HttpContext
.Current.Request.Headers[
"If-Modified-Since"
] !=
null
){
HttpContext
.Current.Response.StatusCode = 304;}
With this, header Connection is set to close. (
Connection: close
) Which I am assuming might be a problem. Is this a problem, can it be avoided?
I tried different alternatives of setting expiration, last modified since, last modified headers, but I could not got proper solution.
Any help in resolving this is higly appreciable.
Reply
Answers (
0
)
Organizing web application problems...
WebParts