cod*_*joe 1 c# asp.net generic-handler
是否可以使用通用处理程序 (*.ashx) 返回 html,我可以在 div 标签中使用它?
就像是
<div id="foo"> [call my generic handler which returns some html to be used within this div ] </div>
Run Code Online (Sandbox Code Playgroud)
在这种情况下,它不是图像,而只是 HTML。
谷歌搜索时没有找到任何东西。
小智 5
是的,你可以返回这样的东西:
public class CustomFormHandler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
context.Response.Write("<p>my html</p>");
}
public bool IsReusable {
get {
return false;
}
}
}
Run Code Online (Sandbox Code Playgroud)