System.Web
Contains types for building ASP.NET web applications.
Classes
-
HttpApplication Classpublic abstract class HttpApplication : IHttpModule
Base class for ASP.NET applications.
Provides event handlers for application-level events such as application start, application end, and request handling.
Example
public class Global : HttpApplication { protected void Application_Start(object sender, EventArgs e) { // Code that runs on application startup RegisterRoutes(); } protected void Application_End(object sender, EventArgs e) { // Code that runs on application shutdown } void RegisterRoutes() { // Example of route registration (hypothetical for System.Web) // RouteTable.Routes.MapPageRoute("Default", "", "~/Default.aspx"); } }
-
HttpRequest Classpublic sealed class HttpRequest
Encapsulates the information that is necessary to use Web-based servers to service incoming requests.
Provides access to request details like URL, HTTP headers, form data, query strings, and cookies.
-
HttpResponse Classpublic sealed class HttpResponse
Encapsulates the information that is necessary to use Web-based servers to service incoming HTTP requests.
Provides methods and properties to construct the HTTP response, including setting headers, status codes, and writing content.
-
HttpContext Classpublic sealed class HttpContext
Encapsulates all information about an individual HTTP request.
This class provides access to the
HttpRequest
,HttpResponse
, andHttpSessionState
objects for the current request. -
HttpCookie Classpublic sealed class HttpCookie
Represents an HTTP cookie.
Allows for the creation, modification, and management of cookies sent to and received from the client.
Interfaces
-
IHttpHandler Interfacepublic interface IHttpHandler
Defines the contract for HTTP handlers that process incoming requests.
Implementations of this interface are responsible for generating the response for a given HTTP request.
-
IHttpModule Interfacepublic interface IHttpModule
Defines the contract for HTTP modules that can process requests and responses.
Modules intercept HTTP requests and responses to perform tasks such as authentication, logging, or modifying content.
Enums
-
HttpVerbs Enumpublic enum HttpVerbs
Defines the standard HTTP request methods.
Common values include
GET
,POST
,PUT
,DELETE
.// Example usage if (Request.HttpMethod == (int)HttpVerbs.Post) { // Handle POST request }