ashx files in asp.net

前端 未结 2 1771
一整个雨季
一整个雨季 2020-12-29 21:35

When do you use ashx files in asp.net web application ? Can some one explain in simple terminology with a pratical example ? I understood from the msdn that .ashx files impl

相关标签:
2条回答
  • 2020-12-29 22:07

    One use I use them for is to use it to handle AJAX requests, and print the output in plaintext format. There is no need to render any HTML controls etc, just plain text/XML etc, and ASHX seems best for that.

    Here is a good overview:

    http://www.dotnetperls.com/ashx

    You want to create an ASP.NET file that is not a typical web forms page. Your file will need to dynamically return an image from a query string, or XML and other non-HTML web pages.

    0 讨论(0)
  • 2020-12-29 22:14

    In short, a file ASHX is an ASPX file, minus all plumbing ASP.NET webform.

    I am using ASHX to generate PDF files on the fly, and download them. Similarly, I use them to generate thumbnails on the fly and download them.

    This could work very well with a blank ASPX, but ASHX files are much less resource-consuming.

    Take a look at this tutorial to see how the files ashx.

    0 讨论(0)
提交回复
热议问题