.aspx 和 .ashx 页面之间有什么区别? 当我需要处理从代码调用并返回响应的请求时,我现在使用 ashx,但我想要更多技术性的答案。
最佳答案
Page
是一个特殊情况处理程序。
通用 Web 处理程序(*.ashx
,基于扩展的处理器)是所有没有 UI 且包含 @WebHandler
的 Web 处理程序的默认 HTTP 处理程序指示。
ASP.NET 页面处理程序 (*.aspx
) 是所有 ASP.NET 页面的默认 HTTP 处理程序。
在内置的 HTTP 处理程序中,还有 Web 服务处理程序 (*.asmx
) 和跟踪处理程序 (trace.axd
)
MSDN says :
An ASP.NET HTTP handler is the process (frequently referred to as the "endpoint") that runs in response to a request made to an ASP.NET Web application. The most common handler is an 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.
下图说明了这一点:
关于你的第二个问题:
Does ashx handle more connections than aspx?
不这么认为(但可以肯定,至少不少于)。
关于asp.net - .aspx 与 .ashx 主要区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5469491/