在 asp.net 中添加我自己的页面扩展
我正在尝试添加带有自定义扩展名的页面,例如带有我的一组 html 标签的 .asp2。 现在,每当我尝试访问浏览器上的页面时...它都会询问我“另存为”。发生这种情况是因为我使用了服务器无法识别的扩展。 我应该怎么做才能让我的服务器 IIS 5.1 识别这个扩展?
请建议
还请建议如何在此类自定义页面上关联自定义事件?
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??
Please suggest
Also please suggest on how to associate custom events on such custom page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Internet 服务管理器中,右键单击“默认网站”,选择“属性”,在“主目录”中按“配置”按钮。单击“添加”按钮,然后在“可执行文件”字段中填写 aspnet_isapi.dll 文件的路径,并将 asp2 放入“扩展名”字段中。
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.
使用非标准扩展,您还应该确保将响应的内容类型设置为 text/html,以便浏览器知道如何解释您发送的文档。像这样的东西:
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: