ASP — Request Object
Request.Form
<%
Dim username
username = Request.Form("username")
Response.Write("Username: " & username)
%>
Request.QueryString
<%
' URL: page.asp?id=42
Dim id
id = Request.QueryString("id")
Response.Write("ID: " & id)
%>
Request.ServerVariables
<%
Response.Write("IP: " & Request.ServerVariables("REMOTE_ADDR"))
Response.Write("User Agent: " & Request.ServerVariables("HTTP_USER_AGENT"))
Response.Write("Method: " & Request.ServerVariables("REQUEST_METHOD"))
Response.Write("URL: " & Request.ServerVariables("URL"))
%>
Common Server Variables
| Variable | Description |
|---|---|
| REMOTE_ADDR | Client IP |
| REQUEST_METHOD | GET or POST |
| HTTP_USER_AGENT | Browser info |
| SCRIPT_NAME | Current script |
| QUERY_STRING | URL parameters |
Request.Cookies
<%
Dim username
username = Request.Cookies("username")
%>
Request.TotalBytes
<%
Dim bytes
bytes = Request.TotalBytes
Response.Write("Bytes received: " & bytes)
%>
Mini Practice
- Get form data
- Get query parameters
- Read server variables
- Check request size
Up Next
Continue with Response Object — response object details.
Related Topics
Frequently Asked Questions about Request Object
What is Request Object in ASP?
Request 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 Request 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 Request Object.
Why is Request Object important in ASP?
Request Object is essential for ASP development. Understanding this concept will help you write better code and solve real-world problems more effectively.