我必须对用户进行身份验证(基本身份验证)才能根据数据源访问None .aspx 文件。我找到了文章并为 .aspx 文件做了它,但是当我尝试将它用于我的文件时**通过将文件扩展名添加到 IIS 作为 MIME 或压缩类型文件,身份验证窗口一直显示并且不会停止。
我该怎么办?
P.S.1. I cannot change the authentication method with form auth or something else.
P.S.2. I cannot change my file type with ".aspx"
P.S.3. URL Re-Writing didn't solve the problem
P.S.4. I added handler to web.config to show the IIS that the new file extention is a script
<handlers>
<add name="NEW FORMAT" path="*.NXX" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule"
scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll"
resourceType="Either" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
</handlers>
最佳答案
您可以使用位置指令来限制对实际文件的访问: http://msdn.microsoft.com/en-us/library/b6x6shw7(v=vs.100).aspx
如果你真的需要,添加 mime 类型:
http://www.iis.net/ConfigReference/system.webServer/staticContent/mimeMap
! 您还可以创建一个 ashx 文件来帮助您传输所需的所有文件,这会增加一些开销,但可以提供更多的安全性。
希望对您有所帮助。
关于c# - MIME 类型文件的 ASP.NET 基本身份验证(无 .aspx 文件),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10765313/