Laden...

Formsauthentication

Erstellt von liam vor 19 Jahren Letzter Beitrag vor 19 Jahren 1.860 Views
L
liam Themenstarter:in
186 Beiträge seit 2004
vor 19 Jahren
Formsauthentication

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>

C
1.215 Beiträge seit 2004
vor 19 Jahren

schau mal auf godotnet.de vorbei - dort gibt es examplarische beispiele für die forms-authentication.

grtz
chief

381 Beiträge seit 2004
vor 19 Jahren

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/

L
liam Themenstarter:in
186 Beiträge seit 2004
vor 19 Jahren

danke klappt jetzt