Sideway
output.to from Sideway
Draft for Information Only

Content

Response Object
 Response.CacheControl Property
   Syntax:
   Parameters:
   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.CacheControl Property

Response.CacheControl property set the value of the HTTP/1.1 Cache-Control header in the Response.Syntax to indicate whether the proxy servers or other cache mechanism can cache the HTML output.

Syntax:

Response.CacheControl [=Cache Control Header]

 Or in an ASP file. Imply

<% Response.CacheControl = Cache Control Header  %>

Parameters:

Cache Control Header

The parameter "Cache Control Header" is the value of the HTTP/1.1 Cache-Control header to output in the HTTP header. The data type of "Cache Control Header" is strings and the value must be enclosed in quotation marks (" "). The possible values of Cache Control Header are

ValueDescription
publicTo specify the response can be cached by a shared caches and to indicate that the responses can be sent to any client
privateDefault value; To specify the response can be cached by a private or non-shared cache and to indicate that the response is only intended for the specified client. The term "private" only specify the type of cached used not the privacy of the response.
no-cacheTo specify the response cannot be reused for the subsequent request and to indicate that the cached responses cannot be reused again even the response for the same client
no-storeTo specify no part of the response can be stored in any type of non-volatile storage for both the shared and the private caches. Th
max-age = delta-seconds To specify the maximum amount of time before the cached response in a cache be considered as expired. The "max-age" directive also overrides the Expires Header. In general, the response is cacheable unless other restrictive cache directive is also present.
s-maxage = delta-seconds To specify the maximum amount of time before the cached response in a public or shared cache be considered as expired. The "s-maxage" directive also overrides both the Expires Header and the "max-age" directive.
must-revalidateTo specify the cached response should follow the cache control directive for supporting a reliable operation or transaction and to inform the cache that the cached response should be revalidated with the original server after the cached response is stale.
proxy-revalidateTo specify the cached response in a public or shared cache should follow the cache control directive for supporting a reliable operation or transaction and to inform the public or shared cache that the cached response should be revalidated with the original server after the cached response is stale.
no-transformTo specify both the non-modifiable headers and any aspect of the entity-body specified by the non-modifiable headers of the cached response in a cache should not be transform
cache-extensionTo extend the Cache-Control header field through the adding of additional informational extensions and behavioral modifier extensions. The new cache extension, if understanded by the application will be recognized as the additional modifier that associated with the standard cache control directive. Or the new cache extension will be ignored and the application will default to the standard cache control directive

Remarks:

The Cache-Control response header was added to HTTP 1.1 for defining how the pages should be handled by caches.

If  there is no cache mechanism between the web server and the client, or the proxy server is running HTTP/1.0, the Cache-Control response header will be ignored

If the response buffering is not enbled, the CacheControl header setting must be set before any response is sent to the client.

The default value of Cache-Control response header of the IIS web server is "Private" which tells cache not to cache pages. Setting the value of Cache-Control response header to "Public" which tells cache to cache page for faster response times. But dynamic pages generated by the response of ASP file may also be interfered by the cache which might delay the response.

Examples:

  • Default value with No Response.CacheControl

    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.CacheControl with value "public"

    ASP script command:

    <% Response.CacheControl = "public" %>

    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: public

  • Response.CacheControl with value "no-cache"

    ASP script command:

    <% Response.CacheControl = "no-cache" %>

    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: no-cache

  • Response.CacheControl with value "no-store"

    ASP script command:

    <% Response.CacheControl = "no-store" %>

    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: no-store

  • Response.CacheControl with value "max-age=86400"

    ASP script command:

    <% Response.CacheControl = "max-age=86400" %>

    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: max-age=86400

  • Response.CacheControl with value "s-maxage=86400"

    ASP script command:

    <% Response.CacheControl = "s-maxage=86400" %>

    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: s-maxage=86400

  • Response.CacheControl with value "must-revalidate"

    ASP script command:

    <% Response.CacheControl = "must-revalidate" %>

    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: must-revalidate

  • Response.CacheControl with value "proxy-revalidate"

    ASP script command:

    <% Response.CacheControl = "proxy-revalidate" %>

    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: proxy-revalidate

  • Response.CacheControl with value "no-transform"

    ASP script command:

    <% Response.CacheControl = "no-transform" %>

    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: no-transform

  • Response.CacheControl with cache-extension

    Example from rfc2616, a cache-extension of new "community" value is added as the modifier directive to the "private" value.

    ASP script command:

    <% Response.CacheControl = "private, community=""UCI""" %>

    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, community="UCI"

  • Response.CacheControl with multiple values

    Example: max-age value plus must-revalidate value to specify that the cache must revalidate the response after the cached response is stale

    ASP script command:t command:

    <% Response.CacheControl = "max-age=86400, must-revalidate" %>

    HTTP header response: 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: max-age=86400, must-revalidate

  • Response.CacheControl with multiple values

    Example: public value plus no-cache value to specify that the response can be cached in a public cache but the response cannot be reused for the subsequent request again even for the same client.

    ASP script command:t command:

    <% Response.CacheControl = "public, no-cache" %>

    HTTP header response: 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: public, no-cache


©sideway

ID: 120100033 Last Updated: 2/2/2012 Revision: 1 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