Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Detecting if modified since in Classic Asp

Reply
Thread Tools

Detecting if modified since in Classic Asp

 
 
Simon
Guest
Posts: n/a
 
      08-06-2008
Hi

I am trying to read the html header 'if modified since' by using
Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP. But I am
unable to get anything from this, this variable is always empty. It is also
excluded when I try to list all the server variables. We are using IIS6.

So please can someone confirm what is the correct syntax?

Cheers,

Simon.
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      08-06-2008
Simon wrote:
> Hi
>
> I am trying to read the html header 'if modified since' by using
> Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP. But
> I am unable to get anything from this, this variable is always empty.
> It is also excluded when I try to list all the server variables. We
> are using IIS6.
>
> So please can someone confirm what is the correct syntax?
>

That is not a standard header so it will not be included when listing
all the server variables (I assume you've done something like this:
http://www.aspfaq.com/2036).

You might want to wade through this thread:
http://www.webmasterworld.com/forum3/6005-2-30.htm

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
 
Simon
Guest
Posts: n/a
 
      08-06-2008
Hi Bob,

Already looked on webmasterworld and that's where I found the following
Request.ServerVariables("HTTP_IF_MODIFIED_SINCE")

But this can't be correct

--
Cheers,

Simon.


"Bob Barrows [MVP]" wrote:

> Simon wrote:
> > Hi
> >
> > I am trying to read the html header 'if modified since' by using
> > Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP. But
> > I am unable to get anything from this, this variable is always empty.
> > It is also excluded when I try to list all the server variables. We
> > are using IIS6.
> >
> > So please can someone confirm what is the correct syntax?
> >

> That is not a standard header so it will not be included when listing
> all the server variables (I assume you've done something like this:
> http://www.aspfaq.com/2036).
>
> You might want to wade through this thread:
> http://www.webmasterworld.com/forum3/6005-2-30.htm
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>

 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      08-06-2008
Hi Jon,

Isn't that just the collection of all the headers as one long string. The
page you pointed me to did not appear to show this data anyway.

--
Cheers,

Simon.


"Jon Paal [MSMD]" wrote:

> it's in Request.ServerVariables("ALL_RAW")
>
> http://neural.cs.nthu.edu.tw/jang/sa...s/request5.asp
>
>
>
> "Simon" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> > Hi
> >
> > I am trying to read the html header 'if modified since' by using
> > Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP. But I am
> > unable to get anything from this, this variable is always empty. It is also
> > excluded when I try to list all the server variables. We are using IIS6.
> >
> > So please can someone confirm what is the correct syntax?
> >
> > Cheers,
> >
> > Simon.

>
>
>

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      08-06-2008
I believe it was in there when Jon looked because he got there via a
google search for that variable name, causing it to appear in the
HTTP_REFERRER.

Again, this isn't a standard header and, while you are supposed to be
able to use this syntax:
HTTP_<HeaderName>
to get non-standard headers, the header you are requesting has to exist
in RAW for it to be available. I can't offer more assistance because
I've never used this header, which seems to be useful for google
indexing, correct? I just do intranet apps so I've never gone there.

Simon wrote:
> Hi Jon,
>
> Isn't that just the collection of all the headers as one long string.
> The page you pointed me to did not appear to show this data anyway.
>
> --
> Cheers,
>
> Simon.
>
>
> "Jon Paal [MSMD]" wrote:
>
>> it's in Request.ServerVariables("ALL_RAW")
>>
>> http://neural.cs.nthu.edu.tw/jang/sa...s/request5.asp
>>
>>
>>
>> "Simon" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi
>>>
>>> I am trying to read the html header 'if modified since' by using
>>> Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP.
>>> But I am unable to get anything from this, this variable is always
>>> empty. It is also excluded when I try to list all the server
>>> variables. We are using IIS6.
>>>
>>> So please can someone confirm what is the correct syntax?
>>>
>>> Cheers,
>>>
>>> Simon.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      08-06-2008
Hi Bob,

Yes this task is related to Google indexing, I am surprised there is so
little info out there on this.

--
Cheers,

Simon.


"Bob Barrows [MVP]" wrote:

> I believe it was in there when Jon looked because he got there via a
> google search for that variable name, causing it to appear in the
> HTTP_REFERRER.
>
> Again, this isn't a standard header and, while you are supposed to be
> able to use this syntax:
> HTTP_<HeaderName>
> to get non-standard headers, the header you are requesting has to exist
> in RAW for it to be available. I can't offer more assistance because
> I've never used this header, which seems to be useful for google
> indexing, correct? I just do intranet apps so I've never gone there.
>
> Simon wrote:
> > Hi Jon,
> >
> > Isn't that just the collection of all the headers as one long string.
> > The page you pointed me to did not appear to show this data anyway.
> >
> > --
> > Cheers,
> >
> > Simon.
> >
> >
> > "Jon Paal [MSMD]" wrote:
> >
> >> it's in Request.ServerVariables("ALL_RAW")
> >>
> >> http://neural.cs.nthu.edu.tw/jang/sa...s/request5.asp
> >>
> >>
> >>
> >> "Simon" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >>> Hi
> >>>
> >>> I am trying to read the html header 'if modified since' by using
> >>> Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP.
> >>> But I am unable to get anything from this, this variable is always
> >>> empty. It is also excluded when I try to list all the server
> >>> variables. We are using IIS6.
> >>>
> >>> So please can someone confirm what is the correct syntax?
> >>>
> >>> Cheers,
> >>>
> >>> Simon.

>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>

 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      08-06-2008
"Simon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I am trying to read the html header 'if modified since' by using
> Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP. But I am
> unable to get anything from this, this variable is always empty. It is

also
> excluded when I try to list all the server variables. We are using IIS6.
>
> So please can someone confirm what is the correct syntax?
>


Ok mucho confusion in this thread I clear that up first.

All headers that are included in the request are accessible to code via the
ServerVariables accessor. IIS does some additional things with headers and
creates a set of other named variables such as URL and also adds things that
have nothing to do with headers such as REMOTE_ADDR.

IIS does some tranforms on the name of a header before making it available.
It Prepends HTTP_, makes all the characters upper case and it converts any
hyphens to underscore. Hence if a client sends the header x-pink-elephants
it can be access as HTTP_X_PINK_ELEPHANTS.

The If-Modified-Since header is a standard header but it isn't always
supplied.

A HTTP server when responding to a request may include in the response a
Last-Modified header. When a client such as IE makes a subsequent request
for the _same_ URL it would normally include the If-Modified-Since request
header.

(Side note: a user can suppress the sending of the If-Modified-Since and the
If-None-Match headers by refreshing using Ctrl-F5 in IE).

Active Server Script generated pages would not send a Last-Modified header
in the response unless the developer deliberately created and added it to
the response themselves. Hence you are not seeing a If-Modified-Since
header.

What is it you want to do with this header? Generate a 304 response?

--
Anthony Jones - MVP ASP/ASP.NET


 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      08-07-2008
Hi Anthony,

Yes I am trying to respond with the 304 header, I am already generating the
last modifed date, which is been detected by the browser, and I can also see
the browser generate the 'if modified since' header. But the webserver does
not see it with Request.ServerVariables("HTTP_IF_MODIFIED_SINCE")

From your comments, it appears that this is the correct way to detect this
header, so maybe I have something blocking this header from reaching the
server, since I know it is been generated.

Regards,

Simon.



--
Cheers,

Simon.


"Anthony Jones" wrote:

> "Simon" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi
> >
> > I am trying to read the html header 'if modified since' by using
> > Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP. But I am
> > unable to get anything from this, this variable is always empty. It is

> also
> > excluded when I try to list all the server variables. We are using IIS6.
> >
> > So please can someone confirm what is the correct syntax?
> >

>
> Ok mucho confusion in this thread I clear that up first.
>
> All headers that are included in the request are accessible to code via the
> ServerVariables accessor. IIS does some additional things with headers and
> creates a set of other named variables such as URL and also adds things that
> have nothing to do with headers such as REMOTE_ADDR.
>
> IIS does some tranforms on the name of a header before making it available.
> It Prepends HTTP_, makes all the characters upper case and it converts any
> hyphens to underscore. Hence if a client sends the header x-pink-elephants
> it can be access as HTTP_X_PINK_ELEPHANTS.
>
> The If-Modified-Since header is a standard header but it isn't always
> supplied.
>
> A HTTP server when responding to a request may include in the response a
> Last-Modified header. When a client such as IE makes a subsequent request
> for the _same_ URL it would normally include the If-Modified-Since request
> header.
>
> (Side note: a user can suppress the sending of the If-Modified-Since and the
> If-None-Match headers by refreshing using Ctrl-F5 in IE).
>
> Active Server Script generated pages would not send a Last-Modified header
> in the response unless the developer deliberately created and added it to
> the response themselves. Hence you are not seeing a If-Modified-Since
> header.
>
> What is it you want to do with this header? Generate a 304 response?
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
>

 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      08-07-2008
Hi Anthony,

I have since done some tests on a simple asp page, and found that the I can
after all read the value in Request.ServerVariables("HTTP_IF_MODIFIED_SINCE").

My test is failing on custom 404 pages, where the web page requested does
not actually exist. I use server.transfer method to a template file that gets
its content from a database.

I imagine that the header is been lost somehow in this process. So I need to
investigate down this route I think now.

--
Cheers,

Simon.


"Simon" wrote:

> Hi Anthony,
>
> Yes I am trying to respond with the 304 header, I am already generating the
> last modifed date, which is been detected by the browser, and I can also see
> the browser generate the 'if modified since' header. But the webserver does
> not see it with Request.ServerVariables("HTTP_IF_MODIFIED_SINCE")
>
> From your comments, it appears that this is the correct way to detect this
> header, so maybe I have something blocking this header from reaching the
> server, since I know it is been generated.
>
> Regards,
>
> Simon.
>
>
>
> --
> Cheers,
>
> Simon.
>
>
> "Anthony Jones" wrote:
>
> > "Simon" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi
> > >
> > > I am trying to read the html header 'if modified since' by using
> > > Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP. But I am
> > > unable to get anything from this, this variable is always empty. It is

> > also
> > > excluded when I try to list all the server variables. We are using IIS6.
> > >
> > > So please can someone confirm what is the correct syntax?
> > >

> >
> > Ok mucho confusion in this thread I clear that up first.
> >
> > All headers that are included in the request are accessible to code via the
> > ServerVariables accessor. IIS does some additional things with headers and
> > creates a set of other named variables such as URL and also adds things that
> > have nothing to do with headers such as REMOTE_ADDR.
> >
> > IIS does some tranforms on the name of a header before making it available.
> > It Prepends HTTP_, makes all the characters upper case and it converts any
> > hyphens to underscore. Hence if a client sends the header x-pink-elephants
> > it can be access as HTTP_X_PINK_ELEPHANTS.
> >
> > The If-Modified-Since header is a standard header but it isn't always
> > supplied.
> >
> > A HTTP server when responding to a request may include in the response a
> > Last-Modified header. When a client such as IE makes a subsequent request
> > for the _same_ URL it would normally include the If-Modified-Since request
> > header.
> >
> > (Side note: a user can suppress the sending of the If-Modified-Since and the
> > If-None-Match headers by refreshing using Ctrl-F5 in IE).
> >
> > Active Server Script generated pages would not send a Last-Modified header
> > in the response unless the developer deliberately created and added it to
> > the response themselves. Hence you are not seeing a If-Modified-Since
> > header.
> >
> > What is it you want to do with this header? Generate a 304 response?
> >
> > --
> > Anthony Jones - MVP ASP/ASP.NET
> >
> >
> >

 
Reply With Quote
 
Simon
Guest
Posts: n/a
 
      08-07-2008
Just to confirm I can read Request.ServerVariables("HTTP_IF_MODIFIED_SINCE"),
on a standard asp page, or an a page that uses transfer.direct.

But I can't read Request.ServerVariables("HTTP_IF_MODIFIED_SINCE"), if I use
a custom 404 page. Yet I can read other variables ok on this same page.

This is driving me nuts!


--
Cheers,

Simon.


"Simon" wrote:

> Hi Anthony,
>
> I have since done some tests on a simple asp page, and found that the I can
> after all read the value in Request.ServerVariables("HTTP_IF_MODIFIED_SINCE").
>
> My test is failing on custom 404 pages, where the web page requested does
> not actually exist. I use server.transfer method to a template file that gets
> its content from a database.
>
> I imagine that the header is been lost somehow in this process. So I need to
> investigate down this route I think now.
>
> --
> Cheers,
>
> Simon.
>
>
> "Simon" wrote:
>
> > Hi Anthony,
> >
> > Yes I am trying to respond with the 304 header, I am already generating the
> > last modifed date, which is been detected by the browser, and I can also see
> > the browser generate the 'if modified since' header. But the webserver does
> > not see it with Request.ServerVariables("HTTP_IF_MODIFIED_SINCE")
> >
> > From your comments, it appears that this is the correct way to detect this
> > header, so maybe I have something blocking this header from reaching the
> > server, since I know it is been generated.
> >
> > Regards,
> >
> > Simon.
> >
> >
> >
> > --
> > Cheers,
> >
> > Simon.
> >
> >
> > "Anthony Jones" wrote:
> >
> > > "Simon" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Hi
> > > >
> > > > I am trying to read the html header 'if modified since' by using
> > > > Request.ServerVariables("HTTP_IF_MODIFIED_SINCE") in classic ASP. But I am
> > > > unable to get anything from this, this variable is always empty. It is
> > > also
> > > > excluded when I try to list all the server variables. We are using IIS6.
> > > >
> > > > So please can someone confirm what is the correct syntax?
> > > >
> > >
> > > Ok mucho confusion in this thread I clear that up first.
> > >
> > > All headers that are included in the request are accessible to code via the
> > > ServerVariables accessor. IIS does some additional things with headers and
> > > creates a set of other named variables such as URL and also adds things that
> > > have nothing to do with headers such as REMOTE_ADDR.
> > >
> > > IIS does some tranforms on the name of a header before making it available.
> > > It Prepends HTTP_, makes all the characters upper case and it converts any
> > > hyphens to underscore. Hence if a client sends the header x-pink-elephants
> > > it can be access as HTTP_X_PINK_ELEPHANTS.
> > >
> > > The If-Modified-Since header is a standard header but it isn't always
> > > supplied.
> > >
> > > A HTTP server when responding to a request may include in the response a
> > > Last-Modified header. When a client such as IE makes a subsequent request
> > > for the _same_ URL it would normally include the If-Modified-Since request
> > > header.
> > >
> > > (Side note: a user can suppress the sending of the If-Modified-Since and the
> > > If-None-Match headers by refreshing using Ctrl-F5 in IE).
> > >
> > > Active Server Script generated pages would not send a Last-Modified header
> > > in the response unless the developer deliberately created and added it to
> > > the response themselves. Hence you are not seeing a If-Modified-Since
> > > header.
> > >
> > > What is it you want to do with this header? Generate a 304 response?
> > >
> > > --
> > > Anthony Jones - MVP ASP/ASP.NET
> > >
> > >
> > >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WebResource.axd caching - MAKING IE issue not-modified-since Sergei Shelukhin ASP .Net 1 02-21-2008 11:55 AM
formatting date/time correctly for If-Modified-Since during AJAX call Cartoper Javascript 2 02-18-2008 05:49 PM
Detecting when an object's instance variables are modified Paul Murton Ruby 7 08-28-2006 05:48 AM
setting If-Modified-Since programmatically Sam Carleton ASP .Net 4 07-04-2006 09:48 PM
Using If-Modified-Since Http Header Roshawn Dawson ASP .Net 4 11-14-2005 09:27 PM



Advertisments