Link to home
Start Free TrialLog in
Avatar of jedistar
jedistarFlag for Singapore

asked on

web.config

I have a web.config in my main folder /

How do i edit this web.config to perform <authentication mode="Forms> for subdirectory
/private and authorization to deny users=?

What do i add in main / web.config
Avatar of quanmac
quanmac

Here's how I did it:

    <authentication mode="Forms">
      <forms      name=".ASPXAUTH"
                  loginUrl="login.aspx"
                  timeout="30"
                  path="/private"
                  protection="All">
            </forms>
    </authentication>
   
    <authorization>
            <deny users="?" />
            <allow roles = "WebUserRole" />
            <deny roles = "NoRoles, Guest, Visitor" />
    </authorization>
Avatar of jedistar

ASKER

how does web.config know the authorization is for /private
ASKER CERTIFIED SOLUTION
Avatar of quanmac
quanmac

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello,

In my web.config..I am trying to add the above code for login process:

    <authentication mode="Forms">
      <forms      name=".ASPXAUTH"
                  loginUrl="login.aspx"
                  timeout="30"
                  path="/private"
                  protection="All">
            </forms>
    </authentication>
   
    <authorization>
            <deny users="?" />
            <allow roles = "WebUserRole" />
            <deny roles = "NoRoles, Guest, Visitor" />
    </authorization>


...to my current web.config below..but I dont think it likes it:
Can I have more than one sql connection in web.config??
----------------------------------------------
<?xml version="1.0"?>
<configuration>
 <connectionStrings>

    This connection is inherited from the ASP.NET Quickstart Web.config file
    Uncomment this section to edit the sample locally

    <add name="Pubs" connectionString="Server=(local)\SQLExpress;Integrated Security=True;Database=pubs;Persist Security Info=True"
      providerName="System.Data.SqlClient" />
    <add name="Northwind" connectionString="Server=(local)\SQLExpress;Integrated Security=True;Database=Northwind;Persist Security Info=True"
      providerName="System.Data.SqlClient" />
    <add name="Contacts" connectionString="Server=(local)\SQLExpress;Integrated Security=True;Database=Contacts;Persist Security Info=True"
     providerName="System.Data.SqlClient" />

    <add name="NorthwindOLEDB" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|Northwind.mdb;"
     providerName="System.Data.OleDb" />
    <add name="ContactsDatabase" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=true;"
     providerName="System.Data.SqlClient" />
 </connectionStrings>
    <system.web>
        <pages styleSheetTheme="Default"/>
        <caching>
            <sqlCacheDependency enabled="true" pollTime="1000">
                <databases>
                    <add name="Pubs" connectionStringName="Pubs"/>
                </databases>
            </sqlCacheDependency>
        </caching>
        </system.web>
</configuration>