Sideway
output.to from Sideway



Draft for Information Only

Content

Response Object
 Constructor
 Properties
 Methods
 Remarks
 Source/Reference

Response Object

The Response object is an instance of the System.Web.HttpResponse class. Response object of ASP.Net is related to sending response from the server to the client. The Response object becomes less importance because the ASP.NET server side objects also have object oriented methods for rendering the response page.

In code, the HttpResponse object is referred to by the keyword Response. For example, Response.Clear() refers to the HttpResponse.Clear method. The Page class has a property that is named Response that exposes the current instance of HttpResponse.

The methods and properties of the HttpResponse class are exposed through the Response property of the HttpApplication, HttpContext, Page, and UserControl classes.

Constructor

Constructor Description
HttpResponse(TextWriter) Initializes a new instance of the HttpResponse class.

Properties

Property Description
Buffer Gets or sets a value indicating whether to buffer output and send it after the complete response is finished processing.
BufferOutput Gets or sets a value indicating whether to buffer output and send it after the complete page is finished processing.
Cache Gets the caching policy (such as expiration time, privacy settings, and vary clauses) of a Web page.
CacheControl Gets or sets the Cache-Control HTTP header that matches one of the HttpCacheability enumeration values.
Charset Gets or sets the HTTP character set of the output stream.
CodePage Set the value of code page for the data of response in the intrinsic objects to specify the character encoding for different languages in the server
ContentEncoding Gets or sets the HTTP character set of the output stream.
ContentType Set the value of content-type header to specify the content type of the HTTP response
Cookies (collection) Gets the response cookie collection.
Expires Gets or sets the number of minutes before a page cached on a browser expires. If the user returns to the same page before it expires, the cached version is displayed. Expires is provided for compatibility with earlier versions of ASP.
ExpiresAbsolute Gets or sets the absolute date and time at which to remove cached information from the cache. ExpiresAbsolute is provided for compatibility with earlier versions of ASP.
Filter Gets or sets a wrapping filter object that is used to modify the HTTP entity body before transmission.
HeaderEncoding Gets or sets an Encoding object that represents the encoding for the current header output stream.
Headers Gets the collection of response headers.
IsClientConnected Gets a value indicating whether the client is still connected to the server.
IsRequestBeingRedirected Gets a Boolean value indicating whether the client is being transferred to a new location.
LCID Set the value of LCID for the data of response output to specify the format of dates, times, and currency for different geographical locale for the server
Output Enables output of text to the outgoing HTTP response stream.
OutputStream Enables binary output to the outgoing HTTP content body.
PICS Set the value of PICS label for the pics-label header to specify the content rating.
RedirectLocation Gets or sets the value of the HTTP Location header.
Status Sets the Status line that is returned to the client.
StatusCode Gets or sets the HTTP status code of the output returned to the client.
StatusDescription Gets or sets the HTTP status string of the output returned to the client.
SubStatusCode Gets or sets a value qualifying the status code of the response.
SuppressContent Gets or sets a value indicating whether to send HTTP content to the client.
TrySkipIisCustomErrors Gets or sets a value that specifies whether IIS 7.0 custom errors are disabled.

Methods

Method Description
AddCacheDependency(CacheDependency[]) Associates a set of cache dependencies with the response to facilitate invalidation of the response if it is stored in the output cache and the specified dependencies change.
AddCacheItemDependencies(ArrayList) Makes the validity of a cached response dependent on other items in the cache.
AddCacheItemDependencies(String[]) Makes the validity of a cached item dependent on another item in the cache.
AddCacheItemDependency(String) Makes the validity of a cached response dependent on another item in the cache.
AddFileDependencies(ArrayList) Adds a group of file names to the collection of file names on which the current response is dependent.
AddFileDependencies(String[]) Adds an array of file names to the collection of file names on which the current response is dependent.
AddFileDependency(String) Adds a single file name to the collection of file names on which the current response is dependent.
AddHeader(String, String) Adds an HTTP header to the output stream. AddHeader(String, String) is provided for compatibility with earlier versions of ASP.
AppendCookie(HttpCookie) Adds an HTTP cookie to the intrinsic cookie collection.
AppendHeader(String, String) Adds an HTTP header to the output stream.
AppendToLog(String) Adds custom log information to the Internet Information Services (IIS) log file.
ApplyAppPathModifier(String) Adds a session ID to the virtual path if the session is using Cookieless session state and returns the combined path. If Cookieless session state is not used, ApplyAppPathModifier(String) returns the original virtual path.
BinaryWrite(Byte[]) Writes a string of binary characters to the HTTP output stream.
Clear() Clears all content output from the buffer stream.
ClearContent() Clears all content output from the buffer stream.
ClearHeaders() Clears all headers from the buffer stream.
Close() Closes the socket connection to a client.
DisableKernelCache() Disables kernel caching for the current response.
End() Sends all currently buffered output to the client, stops execution of the page, and raises the EndRequest event.
Equals(Object) Determines whether the specified object is equal to the current object. (Inherited from Object)
Flush() Sends all currently buffered output to the client.
GetHashCode() Serves as the default hash function. (Inherited from Object)
GetType() Gets the Type of the current instance. (Inherited from Object)
MemberwiseClone() Creates a shallow copy of the current Object. (Inherited from Object)
Pics(String) Appends a HTTP PICS-Label header to the output stream.
Redirect(String) Redirects a request to a new URL and specifies the new URL.
Redirect(String, Boolean) Redirects a client to a new URL. Specifies the new URL and whether execution of the current page should terminate.
RemoveOutputCacheItem(String) Removes from the cache all cached items that are associated with the default output-cache provider. This method is static.
SetCookie(HttpCookie) Because the HttpResponse.SetCookie method is intended for internal use only, you should not call it in your code. Instead, you can call the HttpResponse.Cookies.Set method, as the following example shows. Updates an existing cookie in the cookie collection.
ToString() Returns a string that represents the current object. (Inherited from Object)
TransmitFile(String) Writes the specified file directly to an HTTP response output stream, without buffering it in memory.
TransmitFile(String, Int64, Int64) Writes the specified part of a file directly to an HTTP response output stream without buffering it in memory.
Write(Char) Writes a character to an HTTP response output stream.Writes a character to an HTTP response output stream.
Write(Char[], Int32, Int32) Writes an array of characters to an HTTP response output stream.
Write(Object) Writes an Object to an HTTP response stream.
Write(String) Writes a string to an HTTP response output stream.
WriteFile(IntPtr, Int64, Int64) Writes the specified file directly to an HTTP response output stream.
WriteFile(String) Writes the contents of the specified file directly to an HTTP response output stream as a file block.
WriteFile(String, Boolean) Writes the contents of the specified file directly to an HTTP response output stream as a memory block.
WriteFile(String, Int64, Int64) Writes the specified file directly to an HTTP response output stream.
WriteSubstitution(HttpResponseSubstitutionCallback) Allows insertion of response substitution blocks into the response, which allows dynamic generation of specified response regions for output cached responses.

Remarks

The methods and properties of ASP response object can be grouped into

  • Web Server
    • Server log: AppendToLog;
    • Server Control: TrySkipIisCustomErrors; Close()
  • ASP.NET Control
    • Encoding: CodePage; LCID;
    • Buffer control: Buffer; BufferOutput; Clear(); ClearContent(); Flush();
    • Stop script processing: End();
    • ReadOnly flag: IsClientConnected; IsRequestBeingRedirected
    • Cache: AddCacheDependency(CacheDependency[]); AddCacheItemDependencies(ArrayList); AddCacheItemDependencies(String[]); AddCacheItemDependency(String); DisableKernelCache(); RemoveOutputCacheItem(String);
    • File: AddFileDependencies(ArrayList); AddFileDependencies(String[]); AddFileDependency(String); TransmitFile(String); TransmitFile(String, Int64, Int64);
    • Object: Equals(Object); GetHashCode(); GetType(); MemberwiseClone(); ToString();
  • HTTP Header
    • Moved to a specified URL: Redirect(String); Redirect(String, Boolean); RedirectLocation;
    • Send a status line: Status; StatusCode; StatusDescription; SubStatusCode
    • Add new Header manipulation: Filter; HeaderEncoding; Headers; AddHeader(String, String); AppendHeader(String, String); ClearHeaders();
    • Set value of standard header: Cache; CacheControl; Charset; ContentEncoding; ContentType; Expires; ExpiresAbsolute; Pics(String);
    • Set value of Collection: Cookies; AppendCookie(HttpCookie); ApplyAppPathModifier(String); SetCookie(HttpCookie)
  • HTML Content
    • Direct data Output: BinaryWrite(Byte[]);
    • Encoded Output: Output; OutputStream; Write(Char); Write(Char[], Int32, Int32); Write(Object); Write(String); WriteFile(IntPtr, Int64, Int64); WriteFile(String); WriteFile(String, Boolean);  WriteFile(String, Int64, Int64); WriteSubstitution(HttpResponseSubstitutionCallback); SuppressContent

Source/Reference

  • https://docs.microsoft.com/en-us/dotnet/api/system.web.httpresponse?view=netframework-2.0
  • https://www.go4expert.com/articles/aspnet-server-side-t34114/
  • https://www.tutorialspoint.com/asp.net/asp.net_server_side.htm

©sideway
close

References

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

ID: 190500028 Last Updated: 2019/5/28 Revision: Ref:

IMAGE

Home (5)

Business

Management

HBR (3)

Information

Recreation

Hobbies (7)

Culture

Chinese (1097)

English (336)

Reference (66)

Computer

Hardware (149)

Software

Application (187)

Digitization (24)

Numeric (19)

Programming

Web (602)new

CSS (SC)

ASP.NET (SC)new

HTML

Knowledge Base

Common Color (SC)

Html Entity (Unicode) (SC)

Html 401 Special (SC)

OS (373)new

MS Windows

Windows10 (SC)

.NET Framework (SC)new

DeskTop (6)

Knowledge

Mathematics

Formulas (8)

Number Theory (206)

Algebra (20)

Trigonometry (18)

Geometry (18)

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)

Biology (1)

Geography (1)

Latest Updated Links

Copyright © 2000-2019 Sideway . All rights reserved Disclaimers last modified on 10 Feb 2019