Hi,
ich möchte ein Unterverzeichniss meines Webs mit einer Login Seite versehen, das soll in /admin/ liegen nun möchte ich dieses Verzeichniss schützen wie mache ich das? Soweit bin ich bis jetzt aber das ist noch nicht das richtige.
<authentication mode="Forms">
<forms name="aspnetneuwagen" loginUrl="login.aspx"
protection="All" timeout="20" path="/">
<credentials passwordFormat="MD5">
<user name="admin" password="*" />
</credentials>
</forms>
schau mal auf godotnet.de vorbei - dort gibt es examplarische beispiele für die forms-authentication.
grtz
chief
Verwende das location Element in der web.config:
<configuration>
<system.web>
<authentication mode="Forms">
<forms name="aspnetneuwagen" loginUrl="login.aspx" protection="All" timeout="20" path="/">
<credentials passwordFormat="MD5">
<user name="admin" password="*" />
</credentials>
</forms>
</system.web>
<location path="/admin">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
</configuration>
Wichtig ist das du nur authorization im location Abschnitt verwendest.
Mit freundlichen Grüßen
René Paschold
.NET Developer / Trainer / Speaker / Author /
Projectleader / Software-Architect
.blog http://www.rene-paschold.de/
.business http://www.smarthouse.de/