Question

Is it possible to use a generic handler (*.ashx) to return html, which I can use within a div tag?

Something like

<div id="foo"> [call my generic handler which returns some html to be used within this div ] </div>

In this case it is not an image, but just HTML.

Haven't found anything while googling.

Was it helpful?

Solution

Yes, you can return something like that:

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;
        }
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top