0

My web config, which is a config file in a folder (a config file additional to the main config file in the virtual directory):

> <?xml version="1.0"?>
<configuration>
    <system.web>
      <authentication mode="Forms">
        <forms name=".MyCookie" loginUrl="~/Registration.aspx"   protection="All" timeout="43200" path="/">
          <credentials passwordFormat="MD5">
            <user name="user" password="ca064d0730abfeb09e383a0e82e65f73"/>
          </credentials>
        </forms>
      </authentication>

      <authorization>
        <deny users="?"/>
        <allow roles="Moderator"/>
        <deny users="*"/>
      </authorization>



    </system.web>
</configuration>

The error that I get:

Error 3 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. 5

I am trying to redirect any anonymous users from the administrator and moderator directories.. so I want any anonymous user or users with no role to be redirected to register.aspx..but i dont get it to work because I get that error and I dont know why!! :(

1
  • I am assuming you have a copy post error above? First line first character? Commented Jul 15, 2011 at 11:29

2 Answers 2

1

the authentication tag is not permited on subdirectories web.config, unless you define this subdirectory as a full asp.net application, means a diferent aplication than the root - I not suggest it.

so remove this, and keep it to the root web.config only.

<authentication mode="Forms">... </authentication>
Sign up to request clarification or add additional context in comments.

2 Comments

but then it makes problems....how can I tell the thingy to deliver the user to teh Register page..?
@Matrix001 You do not have no other solution than to use the code behind to handle the differentiation of the situation.
0

You should define your sub directory as location in your web.config.

Check location element. Also check this scenario.

This article explains how to organize your web.configs and location elements.

This is because the section is only supported in IIS application directories, which doesn't include subdirectories of an IIS application.

1 Comment

Just like this: <location path="~/Administrator">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.