I am trying to add page with custom extension, say .asp2 with my set of html tags. Now whenever i try to access the page on browser...it asks me "Save as". This happens because I am using an extn which the server is not able to recognise. What should I do to so that my server, IIS 5.1 recognises this extension??
开发者_如何学GoPlease suggest
Also please suggest on how to associate custom events on such custom page?
In Internet Services Manager, right click on Default Web Site, select Properties, in Home Directory press the Configuration button. Click the Add button and fill the Executable field with the path to the aspnet_isapi.dll file and put asp2 in the Extension field.
Using a non-standard extension, you should also be sure to set the response's Content Type to text/html, so the browser knows how to interpret the document you're sending. Something like:
public class HttpHandler1 : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/html";
// Your code here.
}
}
精彩评论