-3

次のコードがあります: 私の目標は、ユーザーがRegister.aspxページにアクセスしようとしたときにのみ、 Admin.aspxページで認証される必要があることです。次のメッセージが表示されます。

allowDefinition='MachineToApplication' として登録されたセクションをアプリケーション レベルを超えて使用するとエラーになります。このエラーは、仮想ディレクトリが IIS でアプリケーションとして構成されていないために発生する可能性があります。

私は何か間違ったことをしていますか?

       <location path="Report.aspx">        
       <system.web>
         <authentication mode="Forms">
            <forms loginUrl="Admin.aspx" >
                <credentials passwordFormat="Clear">
                    <user name="John" password="pass@432"/>
                </credentials>
            </forms>
         </authentication>
         <authorization>
            <deny users="*" />
         </authorization>
      </system.web>
     </location>
4

1 に答える 1

1

Your application is probably sitting in a folder under your website as part of that website and not an application in its own right.

For IIS 6.1: Go into IIS, right click your applications root folder and select Convert to Application.

Give this a go and see if it helps.

If that dosn't work...

Check you are putting your authentication config in the root web.config file and not in one in a folder lower down. (for example the one sitting in the MVC views folders if using MVC).

Although not related to your problem, as someone else said you have a deny all. To deny unauthenticated users access to the page use the question mark instead of asterix.

 <location path="foo.aspx">
    <system.web>
      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
  </location>
于 2013-04-08T16:25:19.070 に答える