In ASP.NET, "Request" refers to the object that holds information sent by the client to the server during an HTTP request. This information includes data like form values, query string parameters, cookies, and more.
Here's a simple explanation with an example:
Example
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Get the value of a query string parameter named "name"
Dim name As String = Request.QueryString("name")
' Check if the name parameter is present in the request
If Not String.IsNullOrEmpty(name) Then
' Display a personalized greeting
Response.Write("Hello, " & name & "!")
Else
' If the name parameter is not provided, display a generic message
Response.Write("Hello, guest!")
End If
End Sub
In this example:
Request.QueryString("name")
retrieves the value of a query string parameter named "name" from the URL. For example, if the URL is http://example.com/?name=John
, it will retrieve "John".String.IsNullOrEmpty(name)
checks if the "name" parameter is provided in the request.Response.Write()
method.This is a basic example of how you can use the Request
object to retrieve data sent by the client's browser to the server in an ASP.NET application.