2009-12-08 16 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> 

उत्तर

4

आप सेटअप निम्नलिखित तत्वों के साथ web.config चाहिए।

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

आप वेब.कॉन्फिग रखकर फ़ोल्डरों की रक्षा कर सकते हैं जो अज्ञात पहुंच से इनकार करते हैं।

<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 फ़ोल्डर में सोपानी रहा है, अपने इस धारणा सही है, तो उपयोग लॉगिन यूआरएल

<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
संबंधित मुद्दे