Sideway
output.to from Sideway
Draft for Information Only

Content

Response Object
Response.Expires Property
   Syntax:
   Parameters:
   Remarks:
   Examples:
Response.ExpiresAbsolute Property
   Syntax:
   Parameters:
   Remarks: Remarks:
   Examples:

Response Object

Another important function of Response object is the output of HTTP headers to the client. As part of the HTTP header, these types of response objects should be sent before sending any body content to the client.

Response.Expires Property

Response.Expires property sets the length of the time in minutes that the HTML page can be cached on the browser to calculate the absolute expires date & time according to the date & time on the server for the HTTP Expires header.

Syntax:

Response.Expires [=number]

 Or in an ASP file. Imply

<% Response.Expires = number  %>

Parameters:

number

The parameter "number" is the value of duration time in minute of a page in a cache. The data type of "number" is numbers. A value of negative number means immediate expiration. When the calculated absolute expires date from the supplied value of number exceeds January 18, 2038, IIS server will returns an error.

Remarks:

If the same page is requested by client before the page expires, the cached version will be displayed by the client.

If there are multiple Response.Expires or Response.ExpiresAbsolute  on the same page, the web server will use the shortest time period.

Since the system time on the client may not be the same as the system time on the server, setting the parameter of expires to zero sometime does not have the effect of expiring the response immediately. Therefore setting the parameter of expires to a negavtive number can ensure the expiring of the response immediately.

Examples:

  • Default value with No Response.Expires

    ASP script command:

    <%  %>

    HTTP header response:

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Response.Expires with value 10

    ASP script command:

    <% Response.Expires = 10 %>

    HTTP header response: 

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Expires: Tue, 31 Jan 2012 15:29:08 GMT:29:08 GMT
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Response.Expires with value 0

    ASP script command:

    <% Response.Expires = 0 %>

    HTTP header response: 

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Expires: Tue, 31 Jan 2012 15:19:08 GMT:19:08 GMT
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Response.Expires with value -1

    ASP script command:

    <% Response.Expires = -1 %>

    HTTP header response: 

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Expires: Tue, 31 Jan 2012 15:18:08 GMT:18:08 GMT
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Multiple Response.Expires with value 10 and 20

    ASP script command:

    <% Response.Charset = 10 %>
    <% Response.Charset = 20 %> 

    HTTP header response: 

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Expires: Tue, 31 Jan 2012 15:29:08 GMT:29:08 GMT
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

Response.ExpiresAbsolute Property

Response.ExpiresAbsolute property sets the actual  expire date and time that the HTML page can be cached on the browser for the HTTP Expires header.

Syntax:

Response.ExpiresAbsolute [=[date][time]]

 Or in an ASP file. Imply

<% Response.Expires = [date][time]  %>

Parameters:

date

The parameter "date" is the value of expire date of a page in a cache. The data type of "date" is window date format. In general, Date values must be enclosed within pound signs (#) and be in the format M/d/yyyy. But the value sent in the HTTP Expires header will convert to the RFC-1123 date format. If the value of date is not set, the default value of date is the day of the ASP file run. When the absolute expires date from the supplied value of number exceeds January 18, 2038, IIS server will returns an error.

time

The parameter "time" is the value of expire time of a page in a cache. The data type of "time" is window time format. In general, time values must be enclosed within pound signs (#) and be in the format hh:mm:ss. But the value sent in the HTTP Expires header will convert to the RFC-1123 date format with GMT time zone. If the value of time is not set, the default value of time is the midnight of the day of the ASP file run in GMT format.

Remarks: Remarks:

The value of the parameters must be enclosed in pound marks (# #)

If the same page is requested by client before the page expires, the cached version will be displayed by the client.

If there are multiple Response.ExpiresAbsolute or Response.Expires in the same page, the web server will use the shortest time period.

Examples:

  • Default value with No Response.ExpiresAbsolute

    ASP script command:t command:

    <%  %>

    HTTP header response:

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Response.ExpiresAbsolute with value "February 18, 2012 13:30:15"

    ASP script command:

    <% Response.ExpiresAbsolute = #February 18, 2012 13:30:15# %>

    HTTP header response: 

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Expires: Sat, 18 Feb 2012 05:30:14 GMT
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Response.ExpiresAbsolute with value "February 18, 2012"

    ASP script command

    <% Response.ExpiresAbsolute = #February 18, 2012# %>

    HTTP header response: 

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Expires: Fri, 17 Feb 2012 16:00:00 GMT
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Response.ExpiresAbsolute with value "February 18, 2012 13:30:15"

    ASP script command:

    <% Response.ExpiresAbsolute = #13:30:15# %>

    HTTP header response: 

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Expires: Tue, 31 Jan 2012 05:30:14 GMT
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Multiple Response.ExpiresAbsolute with value "February 18, 2012 13:30:15" and Response.Expires with value 10

    ASP script command:

    <% Response.Charset = 10 %>
    <% Response.ExpiresAbsolute = #February 18, 2012 13:30:15# %>  

    HTTP header response: 

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    Content-Length: 0
    Expires: Tue, 31 Jan 2012 15:29:08 GMT
    Content-Type: text/html text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private


©sideway

ID: 120200002 Last Updated: 2/1/2012 Revision: 0 Ref:

close

References

  1. Active Server Pages,  , http://msdn.microsoft.com/en-us/library/aa286483.aspx
  2. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
  3. ASP Best Practices,  , http://technet.microsoft.com/en-us/library/cc939157.aspx
  4. ASP Built-in Objects,  , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
  5. Response Object,  , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
  6. Request Object,  , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
  7. Server Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
  8. Application Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
  9. Session Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
  10. ASPError Object,  , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
  11. ObjectContext Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
  12. Debugging Global.asa Files,  , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
  13. How to: Debug Global.asa files,  , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
  14. Calling COM Components from ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
  15. IIS ASP Scripting Reference,  , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
  16. ASP Keywords,  , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
  17. Creating Simple ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
  18. Including Files in ASP Applications,  , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
  19. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
  20. FileSystemObject Object,  , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  , ADO Object Model
  22. ADO Fundamentals,  , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019