| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#11
| |||
| |||
| 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" <Simon@discussions.microsoft.com> wrote in message > > > news:1E72DB38-3971-4A5C-8FC0-3200D137569D@microsoft.com... > > > > 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 > > > > > > > > > |
|
#12
| |||
| |||
| "Simon" <Simon@discussions.microsoft.com> wrote in message news:22A6A76C-EF6B-4AF0-B7B6-F7EE18C1BF38@microsoft.com... > 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! > When IIS uses the custom 404 page it is effectively a new request. It is a bit weird. What other variables are you able to read? -- Anthony Jones - MVP ASP/ASP.NET |
|
#13
| |||
| |||
| Hi Anthony, I think I can read most other headers including QUERY_STRING, HTTP_HOST. The last one I tried was USER_AGENT. -- Cheers, Simon. "Anthony Jones" wrote: > "Simon" <Simon@discussions.microsoft.com> wrote in message > news:22A6A76C-EF6B-4AF0-B7B6-F7EE18C1BF38@microsoft.com... > > 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! > > > > > When IIS uses the custom 404 page it is effectively a new request. It is a > bit weird. > > What other variables are you able to read? > > > -- > Anthony Jones - MVP ASP/ASP.NET > > > |
|
#14
| |||
| |||
| "Simon" <Simon@discussions.microsoft.com> wrote in message news:327B16CF-AC2B-4B01-A1BF-ACED30E36D6D@microsoft.com... > Hi Anthony, > > I think I can read most other headers including QUERY_STRING, HTTP_HOST. The > last one I tried was USER_AGENT. > > QUERY_STRING and USER_AGENT aren't header variables. You'll note that QUERY_STRING doesn't contain the original query string but begins 404; and then the URL requested. What does USER_AGENT and HTTP_HOST header indicate? Like I said custom error handling is a bit weird, it appears to be a new request but the response is sent on the same connection that created the original request. I suspect that some headers of the original request are copied into this 'new' request but I've never tested which ones. It doesn't surprise me that If-Modified-Since isn't copied, the resource now being requested is not the same one as the client originally requested. -- Anthony Jones - MVP ASP/ASP.NET |
|
#15
| |||
| |||
| Hi Anthony. The headers USER_AGENT and HOST, come through as expected unmodified. I guess you are saying this could be a dead end for me, if certain headers are not passed, although it is strange that everything else seems to be. I don't understand why no one else has come across this problem before. -- Cheers, Simon. "Anthony Jones" wrote: > > "Simon" <Simon@discussions.microsoft.com> wrote in message > news:327B16CF-AC2B-4B01-A1BF-ACED30E36D6D@microsoft.com... > > Hi Anthony, > > > > I think I can read most other headers including QUERY_STRING, HTTP_HOST. > The > > last one I tried was USER_AGENT. > > > > > > QUERY_STRING and USER_AGENT aren't header variables. You'll note that > QUERY_STRING doesn't contain the original query string but begins 404; and > then the URL requested. > > What does USER_AGENT and HTTP_HOST header indicate? > > Like I said custom error handling is a bit weird, it appears to be a new > request but the response is sent on the same connection that created the > original request. > > I suspect that some headers of the original request are copied into this > 'new' request but I've never tested which ones. > > It doesn't surprise me that If-Modified-Since isn't copied, the resource now > being requested is not the same one as the client originally requested. > > > -- > Anthony Jones - MVP ASP/ASP.NET > > > |
|
#16
| |||
| |||
| "Simon" <Simon@discussions.microsoft.com> wrote in message news:98265C9E-36DB-48AD-BBDB-897012EDA9B7@microsoft.com... > Hi Anthony. > > The headers USER_AGENT and HOST, come through as expected unmodified. > > I guess you are saying this could be a dead end for me, if certain headers > are not passed, although it is strange that everything else seems to be. I > don't understand why no one else has come across this problem before. > Mostly likely because you are merging two unusual things. 1) Using the 404 trick is a bit of a hack which works well on its own but a more robust solution would involve an ISAPI filter. 2) Having an ASP page add a Last-Modified header and potentially responding with a 304. This also works reasonably well but is even less common than the 404 trick. It take some effort to acheive especially in when using only VBScript. Hence the combination of the two is likely to be very rare. How complex is the effective URL re-write you are doing? There are I believe some freebie simple URL re-writering filters that are based on Regular expressions. If that can work for you then you won't need the 404 trick. -- Anthony Jones - MVP ASP/ASP.NET |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.