0

global.aspxで:

void Application_BeginRequest(object sender, EventArgs e)
{
  if (ConfigurationManager.AppSettings["MaintenanceMode"] == "true")
    if (!Request.IsLocal)
      if (Request.CurrentExecutionFilePathExtension == ".aspx")
        HttpContext.Current.RewritePath("Maintenance.htm");
}

web.configで:

<appSettings>  
  <add key="MaintenanceMode" value="true"/>  
</appSettings>
<location path="Maintenance.htm">  
  <system.web>
    <authorization>
      <allow users="*" />
    </authorization>
  </system.web>
</location>

Visual Studioを介してローカルでWebサイトを実行すると、すべて問題ありません
が、Webサーバーで、[ユーザー名/パスワード]ログインウィンドウが表示されます。
を押すCancelと、401メッセージが表示されます。
また、正しいユーザー名とパスワードの入力は、ログインウィンドウでは受け入れられません。
フォーム認証を使用しています。

どんなアドバイスでも大歓迎です。

4

2 に答える 2

0

Maintenance.htmファイルをフォーマットに変更するとASPX、問題が解決しました。

于 2012-05-19T20:40:01.323 に答える
0

このエラーを検索している人には、web.configのさまざまなエラーが原因である可能性があることに注意してください。

このweb.configは、私にとって問題を解決したweb.configの本質です。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication userName="" />
            </authentication>
        </security>
    </system.webServer>
</configuration>
于 2014-02-26T22:37:19.967 に答える