I have a very simple Generic Handler, which sends a simple alert to the client. I set the Content-Type
header to be application/x-javascript
, but what I get from server is a text/html
content type.
Here is the code of my generic handler:
public void ProcessRequest(HttpContext context)
{
context.Response.Clear();
context.Response.AddHeader("Content-Type", "application/x-javascript");
context.Response.ContentType = "application/x-javascript";
context.Response.Write("alert('javascript is here');");
context.Response.Flush();
context.Response.End();
}
Now, when I call this handler, via http://domain/path/handler.ashx
, what I get in Firebug is:
Any idea what's wrong?
PS: I want to create a script delivery service, and the script is authored on the fly. That's why I use a dynamic generic handler to serve this script.