2009-12-08 7 views
6

루트 web.config 파일에서이 사양이 맞습니까? 보호 된 폴더에 자식 web.config를 사용하지 않았습니다.폼 인증 web.config 설정

<system.web> 
    <authentication mode="Forms"> 
    <forms name=".ASPXAUTH" loginUrl=""> 
    </forms> 
    </authentication> 
</system.web> 

다음 또한 루트의 web.config에서 system.web 또 다른 사양 :

<location path="to protected folder"> 
    <system.web> 
    <authorization> 
     <deny users="?"/> 
    </authorization> 
    </system.web> 
당신은 설정 다음과 같은 요소와의 Web.config해야

답변

4

.

<configuration> 
    <system.web> 
     <authentication mode="Forms"> 
      <forms name="SiteName" path="/" loginUrl="~/Login.aspx" protection="All" timeout="30" /> 
     </authentication> 
    </system.web> 
</configuration> 

익명 액세스를 거부하는 web.config를 배치하여 폴더를 보호 할 수 있습니다.

<configuration> 
    <system.web> 
    <!-- Place in a sub folder that you want to protect using Forms Authentication --> 
    <authorization> 
     <deny users="?" /> 
    </authorization> 
    </system.web> 
</configuration> 
2

의 Web.config가 chield 폴더에 계단식되어, 당신의 가정이 올바른지, 사용 로그인 URL

<authentication mode="Forms"> 
<forms defaultUrl="~/Step1.aspx" loginUrl="~/Signup.aspx" slidingExpiration="true" timeout="1000"> 
    <credentials passwordFormat="Clear"> 
    <user name="admin" password="123.admin"/> 
    </credentials> 
</forms> 
</authentication> 
<authorization> 
    <allow users="admin" /> 
    <deny users="?"/> 
</authorization> 
0

는 system.web 태그에서 구성 태그 및 인증 요소 아래에 connectionStrings 요소를 추가합니다. 여기

<connectionStrings> 
<add name="cs"connectionString="Data source=server_name; Initial Catalog=database_name; User Id=user_id; Password=user_password" providerName="System.Data.SqlClient" /> 
</connectionStrings> 

<authentication mode="Forms"> 
    <forms loginUrl="~/Home/LogOn"defaultUrl="~/Home/Home"timeout="2880" /> 
</authentication> 

는 여기

Example을하고있다