</>
Skip to content
ASP lessons (16/40)

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

VariableDescription
REMOTE_ADDRClient IP
REQUEST_METHODGET or POST
HTTP_USER_AGENTBrowser info
SCRIPT_NAMECurrent script
QUERY_STRINGURL parameters

Request.Cookies

<%
Dim username
username = Request.Cookies("username")
%>

Request.TotalBytes

<%
Dim bytes
bytes = Request.TotalBytes
Response.Write("Bytes received: " & bytes)
%>

Mini Practice

  1. Get form data
  2. Get query parameters
  3. Read server variables
  4. 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.