私はこの問題を克服することができました。まず、Webでエラー404のリダイレクトを無効にしました。設定:
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="/error/server-error.aspx">
<!-- <error statusCode="404" redirect="/error/resource-not-found.aspx"/> -->
</customErrors>
</system.web>
は、その後、私は私のGlobal.asaxに以下のApplication_Errorイベントハンドラを追加しました:
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim serverError As HttpException = DirectCast(Server.GetLastError(), HttpException)
If Not serverError Is Nothing Then
If 404 = serverError.GetHttpCode() Then
Server.ClearError()
Server.Transfer("/error/resource-not-found.aspx")
End If
End If
End Sub
は最後に、私は、リソース・見つからない(404ページ私のエラーに以下の行を追加しました。 aspx):
Sub Page_Load()
' If you're running under IIS 7 in Integrated mode set,
' use this line to override IIS errors:
Response.TrySkipIisCustomErrors = True
Response.StatusCode = 404
Response.StatusDescription = "Page not found"
End Sub
FYI:MasterPageテクノロジを使用する場合、MasterPageの可変部分だけがリダイレクトされます。私たちのウェブサイトのさまざまなセクションで存在しないリソースを再生した後、私はこの行動が賢明で私たちのエンドユーザにとって有益であることを発見しました。
ワン・モア・シング。非ASPXリソースのHTTPステータスコード404を返すために、私は私のweb.configファイルに次の設定を使用します。
<system.webServer>
<httpErrors errorMode="Custom" defaultResponseMode="Redirect">
<remove statusCode="404"/>
<error statusCode="404" path="/error/resource-not-found.aspx" responseMode="ExecuteURL"/>
</httpErrors>
</system.webServer>
ご注意をエラー404
私は「ExecuteURL」に設定responseModeへこれをPage_Loadに追加すると404ページに循環無限リダイレクトされます。 – TecMan