如何获得的HttpModule火的*使用IIS6的所有*文件扩展名如何获得、文件扩展名、HttpModule

2023-09-06 06:53:33 作者:我的真心错付

我已经了解了足够研究这个问题来推测,这是唯一可能使用通配符映射aspnet_isapi.dll的。我也看到了,这也是不推荐的,但是我发现没有其他的方式来获得的HttpModule任何扩展。

I've learned enough researching this problem to surmise that this is only possible using a wildcard mapping to "aspnet_isapi.dll". I've also read that this is also not recommended, but I've found no other way to get the HttpModule for any extension.

我之所以不能简单地做这种方式是发生故障时,为.asp的扩展名。我得到试图访问ASP文件时,此类型的页是不是先得的消息,即使在ASP文件只有纯HTML,或没有内容的。

The reason I can't simply do it this way is that trouble occurs for the ".asp" extension. I get a "This type of page is not served" message when trying to access ASP files, even if the ASP file only has plain HTML, or has no content at all.

有没有办法告诉.NET不要尝试处理的ASP文件的内容,并只启动HTTP模块?

Is there a way to tell .NET to not try to process the content of asp files, and only launch the HttpModule?

也许我甚至会沿着错误的路线在这里......我只是想.NET code块来执行任何时候一个HTTP请求发送到某个目录,而不管文件扩展名,然后再处理正常的要求。

Maybe I'm even going down the wrong route here...I just want a block of .NET code to execute anytime a HTTP request is made to a certain directory, regardless of file extension, and then handle the request normally.

任何人有什么想法?

推荐答案

可能听起来像一个MIME类型的问题?

Could sound like a MIME type issue?

http://support.microsoft.com/kb/326965

早期版本的IIS包括   通配符MIME映射,它   允许IIS服务的任何文件   不管它的扩展名。 IIS 6.0   不包括该通配符   性格MIME映射和不   用于任何类型的扩展即   在中的MimeMap节点没有定义   IIS元数据库。

Earlier versions of IIS include a wildcard character MIME mapping, which permits IIS to serve any file regardless of its extension. IIS 6.0 does not include this wildcard character MIME mapping and does not serve any type of extension that is not defined at the MimeMap node in the IIS metabase.

要定义MIME类型特定扩展名,请按照下列步骤操作:

To define a MIME type for a specific extension, follow these steps:

打开IIS Microsoft管理控制台(MMC),右键单击本地计算机名称,然后单击属性。 单击MIME类型。 点击新建。 在扩展中,键入所需的文件扩展名(例如,.PDB)。 在MIME类型框中,键入应用程序/八位字节流。 在应用新设置。请注意,您必须重新启动万维网发布服务或等待工作进程循环以使更改生效。在这个例子中,IIS现在.pdb扩展名的文件。 Open the IIS Microsoft Management Console (MMC), right-click the local computer name, and then click Properties. Click MIME Types. Click New. In the Extension box, type the file name extension that you want (for example, .pdb). In the MIME Type box, type application/octet-stream. Apply the new settings. Note that you must restart the World Wide Web Publishing Service or wait for the worker process to recycle for the changes to take effect. In this example, IIS now serves files with the .pdb extension.