web.config, Forms-Based Authentication - newbie spørgsmål
Hey.. jeg har et lille problem med en web.config fil.Jeg har "lånt" koden fra http://www.dotnetjunkies.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/security/CookieAuth/cookieauth.src&file=CS\web.config&font=3 til at lave formbaseret sikkerhed med:
----
<configuration>
<system.web>
<authentication mode="Forms">
<forms name=".ASPXUSERDEMO" loginUrl="login.aspx" protection="All" timeout="60" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
<globalization requestEncoding="UTF-8" responseEncoding="UTF-8" />
</system.web>
</configuration>
----
Det virker fint, lige indtil jeg selv retter lidt i kode for at lave sikkerheden på et under-bibliotek (testbib), istedet for rod-biblioteket ved at gøre følgende:
---- med min tilhøjelse af <location> --
<configuration>
<location path="testbib">
<system.web>
<authentication mode="Forms">
<forms name=".ASPXUSERDEMO" loginUrl="login.aspx" protection="All" timeout="60" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
<globalization requestEncoding="UTF-8" responseEncoding="UTF-8" />
</system.web>
</location>
</configuration>
----
Når jeg så retter min browser i mod en fil i underbiblioteket "testbib" får jeg følgende fejl :
-----
Server Error in '/test' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: 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.
Source Error:
Line 2: <location path="testbib">
Line 3: <system.web>
Line 4: <authentication mode="Forms">
Line 5: <forms name=".ASPXUSERDEMO" loginUrl="testbib/login.aspx" protection="All" timeout="60" />
Line 6: </authentication>
Source File: C:\Inetpub\wwwroot\Test\web.config Line: 4
-----
Hvad er det så jeg har misforstået med hensyn til <location path="testbib"> i min web.config fil ?
hilfe plz ;o)
