ASP — Response Object
Response.Write
<%
Response.Write("Hello, World!")
Response.Write("<h1>Welcome</h1>")
%>
Response.Buffer
<%
Response.Buffer = True
' All output buffered until End or Flush
Response.Flush ' Send buffered output
Response.Clear ' Clear buffer
%>
Response.Redirect
<%
If Not IsLoggedIn Then
Response.Redirect("login.asp")
End If
%>
Response.End
<%
Response.Write("This will show")
Response.End
Response.Write("This will NOT show")
%>
Response.ContentType
<%
Response.ContentType = "text/html"
Response.ContentType = "application/json"
Response.ContentType = "image/png"
%>
Response.AddHeader
<%
Response.AddHeader "X-Custom-Header", "value"
Response.AddHeader "Cache-Control", "no-cache"
%>
Response.Cookies
<%
Response.Cookies("user") = "John"
Response.Cookies("user").Expires = DateAdd("d", 7, Now)
Response.Cookies("user").Path = "/"
%>
Mini Practice
- Output HTML content
- Buffer output
- Redirect pages
- Set headers
Up Next
Continue with Session Object — session object details.
Related Topics
Frequently Asked Questions about Response Object
What is Response Object in ASP?
Response Object is a fundamental concept in ASP. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Response Object?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Response Object.
Why is Response Object important in ASP?
Response Object is essential for ASP development. Understanding this concept will help you write better code and solve real-world problems more effectively.