Sometimes you will need to send static files over http using ASP.Net - for example if you want to control access to the file programmatically. Such tasks can be simply handled by Response.WriteFile(FileName) for plain html files, but there are two problems:
1. GetContentType - returns content-type of a file from registry
2. DateFromHTTP - converts string date from http header (Fri, 09 Sep 2005 07:51:28 GMT format) to Date format
3. DateToHTTPDate - converts date to string format.
for 'Work with If-Modified-Since and Last-Modified in ASP.Net.' articleHow to convert http date to OLE(VB/VBS) date.ASP (VBS) function converting http string date (like Fri, 22 Oct 1999 12:08:38 GMT) to DATE data type.
How to convert DATE to a HTTP string date in ASPASP (VBS) function converting DATE data type to http string date (like Fri, 22 Oct 1999 12:08:38 GMT).
Copyright and use this code
The source code on this page and other samples at https://www.motobit.com/tips/ are a free code, you can use it as you want: copy it, modify it, use it in your products, ...
If you use this code, please:
1. Leave the author note in the source.
2. Link this sample from you page.
<A Href="https://www.motobit.com/tips/detpg_net-last-modified/" Title="Short support vb.Net functions to convert date from/to http string date and sample code to send files with 304 http code" >Work with If-Modified-Since and Last-Modified in ASP.Net.</A>
© 1996 - 2014 Antonin Foller, Motobit Software | About, Contacts | (Find us on Google+)