Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: ASP.NET .NET Work with If-Modified-Since and Last-Modified in ASP.Net. Tutorial

Short support vb.Net functions to convert date from/to http string date and sample code to send static files with 200 OK + Last-Modified http header and 304 Not Modified when If-Modified-Since request header is present.

Tutorial Details:

Work with If-Modified-Since and Last-Modified in ASP.Net

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. Response.ContentType is "text/html" by default. So if you want to write .gif images by ASPX, you have to set right Content-Type http header according to the file type (image/gif).

2. There is a good idea to handle at least Last-Modified and If-Modified-Since headers to reduce traffic and increase performance. Otherways, the file is sent each time.

I created a simple VB.Net support functions for this tasks.

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.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
ASP.NET .NET Work with If-Modified-Since and Last-Modified in ASP.Net. Tutorial

View Tutorial:
ASP.NET .NET Work with If-Modified-Since and Last-Modified in ASP.Net. Tutorial

Related Tutorials:

Program Java devices -- An overview - JavaWorld July 1999
Program Java devices -- An overview - JavaWorld July 1999
 
JavaWorld - Net News Central
JavaWorld - Net News Central
 
Is WSDL the indispensable API?
Is WSDL the indispensable API?
 
Rumble in the jungle: J2EE versus .Net, Part 1
Rumble in the jungle: J2EE versus .Net, Part 1
 
Let the mobile games begin, Part 2
Let the mobile games begin, Part 2
 
Aspirin - embeddable java smtp server
Aspirin - embeddable java smtp server What is it? Aspirin is an embeddable send-only SMTP server. Why would I want that? The JavaMail API doesn't really let you send mail. And that's just annoying. Developers shouldn't have to jump through hoops t
 
JLAN Server v3.3
JLAN Server v3.3 JLAN Server is a high performance JavaTM based file server supporting Windows file sharing (SMB/CIFS), NFS and FTP protocols. Write your own virtual filesystems with the core server handling all protocol exchanges with the client. Incl
 
Light-Weight Visual Components Library for different platform: SWT, J2SE, J2ME, .NET
Light-Weight Visual Components Library for different platform: SWT, J2SE, J2ME, .NET
 
The JDBC RowSet Implementations Tutorial
In "The JDBC RowSet Implementations Tutorial," you will look at how to use the standard JDBC RowSet implementations specified in JSR-114.
 
Jeff Schmitt's JDBC Page
This tutorial assumes you are using the MySQL database and the GWE JDBC drivers. The host computer is triton.towson.edu.
 
Servlet Essentials
This document explains the concepts of Java Servlets and provides a step-by-step tutorial for writing HTTP Servlets with complete source code for the example Servlets. The tutorial and the other chapters cover all facets of Servlet programming from a ...
 
JSP Tutorial
This Tutorial is for beginners in the Java Server Pages Technology
 
JavaServer Pages Technology - Documentation
Sun's tutorial for Java Server Pages that provide a good introduction to design web pages with JSP.
 
Tag Libraries Tutorial
This tutorial describes how to use and develop JavaServer Pages tag libraries. The tutorial assumes that you know how to develop servlets and JSP pages and are familiar with packaging servlets and JSP pages into Web application archives.
 
Device Driver Tutorial for the Solaris OS
Make your hardware work with the Solaris OS on x86 or SPARC architectures. If you are a beginning Solaris kernel programmer, start with this new tutorial on docs.sun.com.
 
Domain Registration Guide
Domain Registration Guide Domain Registration Guide What is Domain? Internet is the large network of computers. On the Internet there should be some way to identify the computers. Domain name is the solution for this. Domain Name is the unique
 
Open Source Web Frameworks in Java
Open Source Web Frameworks in Java Open Source Web Frameworks in Java Struts Struts Frame work is the implementation of Model-View-Controller (MVC) design pattern for the JSP. Struts is maintained as a part of Apache Jakarta project and is open
 
10 Minutes Guide to Ant
10 Minutes Guide to Ant 10 Minutes Guide to Ant Previous Tutorial Index Next Introduction Well for the next 10 minutes get ready to devote to the ant guide. This will make some sence to the ant. Ant is a free tool under GNU Licence and is
 
Struts Guide
Struts Guide Struts Guide This tutorial is extensive guide to the Struts Framework. In this tutorial you will learn how to develop robust application using Jakarta Struts Framework. This tutorial assumes that the reader is familiar with the web
 
What is WAP? Detailed discussion of WAP API with examples.
What is WAP? Detailed discussion of WAP API with examples. Learn WAP in 60 minutes W ireless Application Protocol or WAP for short, allows the developers to develop next generation web application for cellular devices. Through WAP enabled mobile
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.