The ASP Response object sends response from the server processing the ASP page back to the user’s browser requesting the ASP page.
The ASP Response object has several collections, methods and properties and I’ll show you how to use the most important one.
Response.Buffer property - The Boolean Response.Buffer property tells the server processing the ASP page whether to buffer the output sent to the browser or not. Always set the Response.Buffer property, before the first HTML tag (usually ) in the ASP page:
Response.Buffer = True
Response.Expires property – Response.Expires property tells the server for how many minutes to cache the page in the browser.
Response.Expires = 5
Response.Write method – Response.Write method is probably the most used Response object method, which simply outputs a string to the client’s browser.
Response.Write “Hello there…”
Response.Redirect method – The Response.Redirect method is another very important method used to redirect the browser to a different URL:
Response.End method – The Response.End method tells the server to stop the ASP page processing:
Response.Cookies collection – The Response.Cookies collection is used to write cookies on the client computer.
Response.Cookies(“Date”) = Now()
The above code creates a cookie named Date with value the date/time when the cookie was created. If the cookie already exists, the old cookie value will be overwritten.
You can set an expiration date for the cookie with the following code:
Response.Cookies(“Date”).Expires = Now()+1
The line above sets the cookie to expire after 24 hours.