Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

HTTP handler

From Wikipedia, the free encyclopedia
ASP.NET process

An ASP.NETHTTP handler is a process that runs in response to a request made to anASP.NET Web application.[1] The most common handler is the ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page through the page handler.[2]

HTTP handlers are an essential component of the ASP.NET framework, providing a low-level way to interact with incoming HTTP requests. They offer developers fine-grained control over how specific requests are processed, allowing for custom handling of various file types or URL patterns.[3]

HTTP handlers were not present in the "Classic"ASP. They implement theSystem.Web.IHttpHandler interface. UnlikeASP.NET Web Forms, they have no HTML-markup file, no events and other supporting. All they have is a code-file (written in any.NET-compatible language) that writes some data to the server HTTP response. HTTP handlers are similar toISAPI extensions.[4]

TheIHttpHandler interface defines two key members: 1.IsReusable: A boolean property indicating whether the handler can be reused for multiple requests. 2.ProcessRequest: A method that contains the actual request processing logic.[5]

Developers can create custom HTTP handlers to implement specialized functionality, such as: 1. Generating dynamic images or documents on-the-fly. 2. Implementing custom authentication or authorization schemes. 3. Handling specific file types or URL patterns in a unique way. 4. Creating RESTful web services.[6][7]

An HTTP module is an assembly that is called on every request that is made to your application. HTTP modules are called as part of the ASP.NET request pipeline and have access to life-cycle events throughout the request. HTTP modules let you examine incoming and outgoing requests and take action based on the request.[8]

While HTTP handlers are responsible for generating the response to a specific request, HTTP modules can intercept and process all requests that pass through the ASP.NET pipeline. This makes modules ideal for implementing cross-cutting concerns such as logging, security, or performance monitoring.[9]

Unlike ASP.NET Web Forms, that have ".aspx" file extension, ASP.NET handlers by default have ".ashx" file extension.[10]

Handlers are considered to be more lightweight object than ASP.NET Web Forms. That is why they are used to serve dynamically-generated images, on-the-fly generatedPDF-files and similar content to theweb browser.[11]

To configure an HTTP handler in an ASP.NET application, developers can use the<httpHandlers> section in the web.config file. This allows for mapping specific file extensions or URL patterns to custom handler classes.[12]

WithASP.NET Core, this HTTP handlers have been replaced with "middleware" ApplicationBuilders (IApplicationBuilder) which allow routing requests based on request headers instead of just the URL path.[13]

The transition to middleware in ASP.NET Core represents a significant shift in the request processing model. Middleware components are more flexible and can be easily chained together to form a request processing pipeline. This new approach offers several advantages: 1. Greater modularity and reusability of request processing components. 2. Simplified configuration and setup compared to the handler/module system. 3. Improved performance due to reduced overhead in request processing. 4. Better support for asynchronous processing and modern programming patterns.[14]

Despite these changes, the core concepts behind HTTP handlers remain relevant in understanding how web applications process and respond to HTTP requests, making them an important topic for ASP.NET developers to study.[15]

See also

[edit]

References

[edit]
  1. ^"HTTP Handlers and HTTP Modules Overview".msdn.microsoft.com. Retrieved15 March 2017.
  2. ^Archiveddocs."HTTP Handlers and HTTP Modules Overview".learn.microsoft.com. Retrieved2023-02-06.
  3. ^Rick-Anderson."IHttpHandler Interface (System.Web)".learn.microsoft.com. Retrieved2024-11-04.
  4. ^"Handlers in ASP.NET".Home. 2010-05-14. Retrieved2023-02-06.
  5. ^"IHttpHandler - ASP.NET in a Nutshell [Book]".www.oreilly.com. Retrieved2024-11-04.
  6. ^Rick-Anderson."IHttpHandler Interface (System.Web)".learn.microsoft.com. Retrieved2024-11-04.
  7. ^"The Truth About HttpHandlers and WebApi".CodeProject. 2013-02-03. Retrieved2024-11-04.
  8. ^Archiveddocs."HTTP Handlers and HTTP Modules Overview".learn.microsoft.com. Retrieved2023-02-06.
  9. ^Bahree, Amit (2004-10-28)."HTTP Modules and HTTP Handlers".Amit Bahree's (useless?) insight!. Retrieved2024-11-04.
  10. ^Tripathi, Mayank."HTTP Handlers And HTTP Modules In ASP.NET".www.c-sharpcorner.com. Retrieved2023-02-06.
  11. ^"Handlers in ASP.NET".Home. 2010-05-14. Retrieved2023-02-06.
  12. ^"HTTP Handlers and modules in ASP.NET websites".Greystoke Systems Ltd. Retrieved2024-11-04.
  13. ^"Migrate HTTP handlers and modules to ASP.NET Core middleware". ASP.NET Core.Microsoft Docs. Retrieved2019-10-17.
  14. ^"Ultimate Starter Guide to Middleware in ASP.NET Core".www.devleader.ca. 2024-02-01. Retrieved2024-11-04.
  15. ^Rick-Anderson."IHttpHandler Interface (System.Web)".learn.microsoft.com. Retrieved2024-11-04.

External links

[edit]
Protocols
Server APIs
Apache modules
Topics
Browser APIs
Web APIs
WHATWG
W3C
Khronos
Others
Topics
Related topics
Implementations
Architecture
Components
Tools
Decompilers
Obfuscators
IDEs
Organizations
Graphics and UI
Audio
Multimedia
Web
Data access
Networking
Communication
Administration and
management
Component model
Libraries
Device drivers
Security
.NET
Software factories
IPC
Accessibility
Text and multilingual
support
Microsoft development tools
Development
environments
Visual Studio
Others
Languages
APIs and
frameworks
Native
.NET
Device drivers
Database
SQL Server
SQL services
Other
Source control
Testing and
debugging
Delivery
People
Founders
Board of directors
Senior leadership team
Corporate VPs
Employee groups
Products
Hardware
Software
Programming
languages
Web properties
Company
Conferences
Divisions
Estates
Campaigns
Criticism
Litigation
Acquisitions
Retrieved from "https://en.wikipedia.org/w/index.php?title=HTTP_handler&oldid=1255363885"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp