Hi Sunny,
If you did not set the HttpWebRequest.IfModifiedSince property, .Net will
default set the HttpWebRequest.IfModifiedSince as the current
time.(Actully, it just return the current time). And .Net will not send
this value to the server side. So default, the page content will be
returned.
So if you set a time between now and the page's last modified time to
HttpWebRequest.IfModifiedSince, your application will generate 403
exception which denotes the page file did not modified.
Btw: You should not specify a future time to this property, or it will
return the content of the page.(You can confirm this by specify 2004,1,1 to
HttpWebRequest.IfModifiedSince).
Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| From: Sunny <sunnyask@icebergwireless.com>
| Subject: RE: web pages cacheing
| Date: Thu, 13 Nov 2003 12:01:05 -0600
| References: <OBxbALKpDHA.2000@TK2MSFTNGP12.phx.gbl>
<UoZZWxPpDHA.2528@cpmsftngxa06.phx.gbl>
<OrdjauTpDHA.360@TK2MSFTNGP12.phx.gbl>
<XrHzcr1pDHA.1736@cpmsftngxa06.phx.gbl>
<OBjOKiKqDHA.2636@tk2msftngp13.phx.gbl>
<TMY9#SQqDHA.1804@cpmsftngxa06.phx.gbl>
<#WoZcmUqDHA.2848@TK2MSFTNGP10.phx.gbl>
<EHEK3IZqDHA.576@cpmsftngxa06.phx.gbl>
| Organization: Iceberg Wireless LLC
| MIME-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-15"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: MicroPlanet Gravity v2.60
| Message-ID: <#ptDdAhqDHA.2216@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 216.17.90.91
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:199085
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hi Jeffrey,
| thanks for clarifying this. I'll try HEAD and NetMon to see.
|
| So, following your explanation, it seems that the example for If-
| Modified-Since in MSDN is wrong then. I.e., what they are checking in
| the "if" statement if the connection is not established and they haven't
| set the property yet?
|
| Thanks
| Sunny
|
| In article <EHEK3IZqDHA.576@cpmsftngxa06.phx.gbl>, v-
| (e-mail address removed) says...
| >
| > Hi Sunny,
| >
| > Sorry for letting you wait for so long.
| > The "IfModifiedSince" property is used to set the "If-Modified-Since"
| > header of the HTTP request. When the HTTP request with
"If-Modified-Since"
| > header set is received by the HTTP server, and the requested file has
not
| > been modified since the time specified in this field, the server will
not
| > return the file. Instead, a HTTP 304 code will be returned. If the file
has
| > been modified since the time specified, the file will be returned.
| >
| > So you can set the IfModifiedSince property to your client file's last
get
| > date, then it will hehave what you want.
| >
| > Also, I think you can specify the HttpWebRequest.Method property to
"HEAD",
| > then it will not send the body of the document.
| > If you need to see what is really going over the wire, you can use
NetMon
| > to monitor this.
| >
| > Hope this helps,
| >
| > Best regards,
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! -
www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
|