Sideway
output.to from Sideway
Draft for Information Only

Content

Response Object
Response.PICS Property
   Syntax:
   Parameters:
   Remarks:
   Examples:
Response.AddHeader Method
   Syntax:
   Parameters:
   Return Values:
   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.PICS Property

Response.PICS property sets the value of PICS label for the pics-label header to specify the content rating. PICS (Platform for Internet Content Selection) was designed to label or to rate the content

Syntax:

Response.PICS (PICSLabel)

 Or in an ASP file. Imply

<% Response.PICS = PICSLabel %>

Parameters:

PICSLabel

The parameter "PICSLabel" is the content rating of a page. The data type of "PICSLabel" is string of the form formatted PICS label.

Remarks:

There is no mechanism to validate whether the specified value represents a valid PICS label or not.

The value of PICSLabel must be enclosed in quotation marks (" ") and therefore the quotes in PICS label must be placed by chr(34)

If there are multiple Response.PICS in the same page, the last instance of Response.PICS in the HTTP header setting of a ASP file will replace all previous Response.PICS Setting?.

Examples:

  • Default value with No Response.PICS

    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.PICS with value "(PICS-1.1 "& chr(34) & "http://www.classify.org/safesurf/" & chr(34) & " l r (SS~~000 1))"

    ASP script command:

    <% Response.PICS("(PICS-1.1 " & chr(34) & "http://www.classify.org/safesurf/" & chr(34) & " l r (SS~~000 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
    pics-label: (PICS-1.1 "http://www.classify.org/safesurf/" l r (SS~~000 1))
    Content-Length: 0
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

Response.AddHeader Method

Response.AddHeader Method adds a new HTTP header with name "HeaderName" and sets the value to "HeaderValue".

Syntax:

AddHeader(
    HeaderName,
    HeaderValue
)

 Or in an ASP file. Imply

<% Response.AddHeader "HeaderName", "HeaderValue"  %>

Parameters:

HeaderName

The parameter "HeaderName" is the name of added header. The data type of "HeaderName" is string and the value must be enclosed within quotation signs (" ").

HeaderValue

The parameter "HeaderValue" is the value of added header. The data type of "HeaderValue" is string and the value must be enclosed within quotation signs (" ").

Return Values:

This method has no return values.

Remarks:

The Response.AddHeader Method always append the added header to the HTTP header. The value of the added header does not replace any existing header with the same name.

The values of the parameters must be enclosed in quotation marks (" ").

The customer header value can be retreived by Request.ServerVariables by adding "HTTP_" to the beginning of the custom header name if the client is configured to return response header to the server on a subsequent request. Therefore the retriving of the customer header value is highly depending on the configuration of the client and this method should be avoided if other method can provide the funcionality as required.

Since the ServerVariables collection interprets underscores as dashes in the header name, the HeaderName should not contain any underscore (_) characters to avoid name ambiguity.

As the HTTP header should send before the HTML output, if the response buffer is not enbled in IIS 4.0, all Response.AddHeader method should run before sending any response to client. IN IIS 5.0 or later, the response buffer is enabled by default, all Response.AddHeader method should run before calling Response.Flush method to sent the response to the client.

Examples:

  • Default value with No Response.AddHeader

    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.AddHeader with customer HTTP Header "CustomHeader, CustomerValue"

    ASP script command:

    <% Response.AddHeader "CustomHeader", "CustomerValue"  %>

    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
    CustomHeader: CustomerValue
    Content-Length: 0
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Response.AddHeader with standard HTTP Header "Pragma, no-cache" to specify a cache using HTTP/1.0 not to cache the page

    ASP script command

    <% Response.AddHeader "Pragma", "no-cahce"  %>

    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
    Pragma: no-cache
    Content-Length: 0
    Content-Type: text/html
    Set-Cookie: ASPSESSIONIDPPPP=PPPPPPPP; path=/
    Cache-control: private

  • Response.AddHeader with standard HTTP Header "WWW-Authenticate, BASIC" to specify the client use Basic Authentication.

    ASP script command

    <% Response.AddHeader "WWW-Authenticate", "Basic"  %>

    HTTP header response: 

    WWW-Authenticate: Basic

    The WWW-Authenticate response header must be included in the 401 Unauthorized response. messages for an unauthorized request.

    CMD commands: 

    telnet 127.0.0.1 80 (CR)
    GET /login.asp HTTP/1.1 (CR)
    Host: 127.0.0.1 (CR)
     (CR)

    HTTP header response: 

    HTTP/1.1 401 Access Denied
    Server: Microsoft-IIS/5.1
    Date: Tue, 31 Jan 2012 15:19:08 GMT
    X-Powered-By: ASP.NET
    WWW-Authenticate: Negotiate
    WWW-Authenticate: NTLM
    WWW-Authenticate: Basic realm="127.0.0.1"
    Connection: close
    Content-Length: 4000
    Content-Type: text/html


©sideway

ID: 120200004 Last Updated: 2/2/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

Set 1

Logic 1

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