[英]How to Allow download of .cs files from asp.net website?
我有一個在godaddy服務器上運行的網站,它有C#教程和帶有.cs擴展名的關聯代碼文件。
我想做的是,單擊下載按鈕時,它應該觸發.cs文件的下載。 但這給了我以下錯誤
Localhost錯誤:
無法提供此類頁面。 說明:由於明確禁止了您請求的頁面類型,因此無法提供。 擴展名“ .cs”可能不正確。 請查看下面的URL,並確保其拼寫正確。 要求的網址:/WebSite1/SimpleHandler.cs
請告訴我如何清除此錯誤。
您需要進行兩項更改:
1)允許IIS全局配置文件中的requestFiltering
更改全局配置文件:%systemroot%\\ System32 \\ inetsrv \\ config \\ applicationHost.config
<section name="requestFiltering" overrideModeDefault="Allow" />
2)允許在網站的web.config中下載.cs文件
<system.webServer>
<security>
<!-- Very important, the IIS configuration must have the
overrideModeDefault to allow in the file
%systemroot%\System32\inetsrv\config\applicationHost.config -->
<!-- section name="requestFiltering" overrideModeDefault="Allow" /> -->
<requestFiltering>
<fileExtensions allowUnlisted="true">
<remove fileExtension=".cs" />
</fileExtensions>
</requestFiltering>
</security>
...
</system.webServer>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.