spacer
Yehuda Shiran October 17, 2002
Using the Global Response Object
Tips: October 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

ASP.NET inherited the built-in objects from ASP. These objects are global in the sense that you don't need to construct them or pass them around; they are always there. There are five built-in objects: Request, Response, Server, Session, and Application.

The Response object is used to pass information to the user. These are its properties:

  • Buffer: a Boolean directing the server (if true) to buffer its output until all server scripts on the current page have been processed, or until the Flush or End method has been called.
  • ContentType: the type of content sent back (text/HTML, Excel, etc.)
  • Expires: the time in minutes after which the user's cache for this page is invalid.
  • ExpiresAbsolute: the absolute date and time for expiration of the user's cache for this page.
  • Status: returns the status line (defined in the HTTP specification of the server).

The Response object supports the following methods:

  • AddHeader: adds an HTML header with a specified string value.
  • AppendToLog: appends a string to the Web server log file.
  • BinaryWrite: write binary data (i.e. Excel file).
  • Clear: clears any buffered HTML output.
  • End: stops processing the script.
  • Flush: sends all the information in the buffer.
  • Redirect: redirects the user to another URL.
  • Write: writes into the HTML stream. You can use Response.write("Hello There") or <%"Hello There"%>

The Response object includes one collection, Cookies. In IBuySpy, we use these cookies to persistently save the user name:

  Response.Cookies["IBuySpy_FullName"].Value = Server.HtmlEncode(Name.Text);

People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint