• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 701
  • Last Modified:

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
0
jedistar
Asked:
jedistar
  • 2
1 Solution
 
quanmacCommented:
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>
0
 
jedistarAuthor Commented:
how does web.config know the authorization is for /private
0
 
quanmacCommented:
<forms     name=".ASPXAUTH"
               loginUrl="login.aspx"
               timeout="30"
               path="/private"
               protection="All">
          </forms>

The path="..." is where you put which folder you would like to protect. If you wanted the entire folder you would put path="/"
0
 
GlobaLevelCommented:
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>
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now