![](/img/trans.png)
[英]“HTTP Error 404. The requested resource is not found.” when website tries to access database or any other site
[英]IIS throwing HTTP 404 not found but resource exists. Requested URL also changing automatically.!
我的本地IIS在這里面臨着一個非常奇怪的情況。 我已經在本地IIS的默認網站中托管了多個網站。 其中之一具有登錄頁面。 從登錄頁面,我將用戶重定向到位於另一個站點(也位於默認網站虛擬目錄內的同一IIS中)的另一個頁面。
) ". 現在,在登錄頁面的“提交”按鈕單擊事件中,對用戶進行身份驗證之后,我編寫了“ Response.Redirect( ) ”。 is being formed dynamically and given as a parameter to the Redirect method. 是動態形成的,並作為Redirect方法的參數提供。
that is being sent as parameter to Redirect method is: 調試時,作為參數發送給Redirect方法的最終是:
http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
shown in the error page is different that what was dynamically sent to the Response.Redirect(...) method. 但是,在嘗試進行下一步之后,我突然收到一個HTTP 404錯誤,提示該資源不存在,並且我發現錯誤頁面中顯示的與動態發送給Response的 不同。 .Redirect(...)方法。
shows the value as 在錯誤頁面中,所將值顯示為
http://localhost/CP/web/console/localhost/CPLogin?err=5
formed in the code is: 而在代碼中形成的是:
http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
我只是無法理解為什么請求的網址會自動更改。 另外,我發現“ localhost”再次被附加到請求的URL,這不是應該發生的情況。
請訪問此鏈接 [^]以更清楚地了解此問題。 我添加了錯誤頁面的屏幕截圖。
http://amoghnatu.wordpress.com/2013/09/16/question-please-help-iis-throwing-http-404-not-found-but-requested-resource-actually-exists-requested-url-also-自動更改/ [^]
非常感謝。!
確實,問題出在我在應用程序中托管網站的方式。 我剛剛從IIS中刪除了與我的應用程序相關的所有站點,然后再次更加仔細地托管了所有這些站點。 這解決了“錯誤的重定向URL”問題。
另外,我有一些表缺少必需的數據,因此我收到了錯誤代碼。
因此,在我將所有表都填充了所需的數據之后,並且在將應用程序正確地托管在IIS中之后,我的問題得到了解決。
在IIS中,轉到相關文件夾,右鍵單擊並“瀏覽”。 查看什么是URL。 在大多數情況下,這是由於URL應當附加端口號。 例如,它將類似於:
http://localhost:<port number>/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
代替
http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.