2012年10月18日

ASP.NET Http Handler

使用 .ashx

HttpContext.Request["..."]


HttpContext.Response.ClearContent();
HttpContext.Response.ClearHeaders();
HttpContext.Response.Clear();
HttpContext.Response.ContentType = "application/json";
HttpContext.Response.Write(resultResponse);
HttpContext.Response.Flush();
HttpContext.Response.End();

web.config
<configuration>
    <system.web>
        <httpHandlers>
            <add name="DownloadHandler" verb="*" path="*.zip" type="... .XXXHandler"/>

verb: get, post, ...
path: *, *.zip, *.jpg, ...
type: (namespace).(class name)

沒有留言:

張貼留言