What are the differences between .aspx and .ashx pages? I use ashx now when I need to handle a request that was called from code and returned with a response, but I would like a more technical answer please.
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- 'System.Threading.ThreadAbortException' in
- Request.PathInfo issues and XSS attacks
- How to dynamically load partial view Via jquery aj
Page
is a special case handler.Generic Web handler (
*.ashx
, extension based processor) is the default HTTP handler for all Web handlers that do not have a UI and that include the@WebHandler
directive.ASP.NET page handler (
*.aspx
) is the default HTTP handler for all ASP.NET pages.Among the built-in HTTP handlers there are also Web service handler (
*.asmx
) and Trace handler (trace.axd
)MSDN says:
The image below illustrates this:
As to your second question:
Don't think so (but for sure, at least not less than).
.aspx
uses a full lifecycle (Init
,Load
,PreRender
) and can respond to button clicks etc.An
.ashx
has just a singleProcessRequest
method..aspx is a rendered page. If you need a view, use an .aspx page. If all you need is backend functionality but will be staying on the same view, use an .ashx page.