German Wear Discount Shop - Click Here Write for Dotnet-friends and earn for your each submission [Dot]Net-Friends
Skip Navigation Links
Home
Latest
Fast Code
Articles
Tutorials
Online Resources
Forums
Login   | Hi, Guest


An example of the Web.Config with the least Security

Written by omerkamal on Jul 14, 2007
Web.config code with the least security for ASP .NET 2.0

Explanation:

xmlversion="1.0"?>
<configurationxmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
 <connectionStrings>
<removename="LocalSqlServer" />
<addname="LocalSqlServer"connectionString="Data Source=SERVER_IP_HERE;User ID=username; password=password"providerName="System.Data.SqlClient" />
<addname="Personal"connectionString="Data Source=SERVER_IP_HERE;User User ID=username; password=password "providerName="System.Data.SqlClient" />
 connectionStrings>
 <system.web>
    <pages styleSheetTheme="White"/>
    <customErrorsmode="Off">customErrors>
    <compilationdefaultLanguage="C#"debug="false">
      <assemblies>
        <addassembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      assemblies>
    compilation>
    <authenticationmode="Forms">
      <formsname="dotnetFriends" loginUrl="Login.aspx"timeout="60"/>   
    authentication>
    <authorization>
      <allowusers="*"/>
    authorization>
    <globalizationrequestEncoding="utf-8"responseEncoding="utf-8"culture="en-GB"/>
    <roleManagerenabled="true" >
      <providers>
<addconnectionStringName="LocalSqlServer"
applicationName="LoginControls"
name="QuickStartRoleManagerSqlProvider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      providers>
    roleManager>  
    <membershipdefaultProvider="KamalMembershipProvider" >
      <providers>
        <removename="AspNetSqlProvider" />
        <addname="KamalMembershipProvider"
          connectionStringName="LocalSqlServer"
          enablePasswordRetrieval="true"
          enablePasswordReset="true"
          requiresQuestionAndAnswer="false"
          applicationName="/"
          requiresUniqueEmail="false"
          passwordFormat="Clear"
          maxInvalidPasswordAttempts="10"
          minRequiredPasswordLength="1"
          minRequiredNonalphanumericCharacters="0"
          passwordAttemptWindow="10"
          type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      providers>
    membership>
    <anonymousIdentificationenabled="false" />
    <profileenabled="true"automaticSaveEnabled="false">
      <properties>
        <addname="FirstName" />
        <addname="LastName" />
        <addname="Gender" />
        <addname="Bday"type="System.DateTime"/>
        <addname="Address" />
        <addname="City" />
        <addname="Country" />     
        <addname="UserInfo" />
        <addname="ShowEmail" />
      properties>
    profile>
    <siteMapdefaultProvider="XmlSiteMapProvider"enabled="true">
      <providers>
<addname="XmlSiteMapProvider"description="SiteMap provider which reads in Web.sitemap XML files"
type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
siteMapFile="web.sitemap"securityTrimmingEnabled="true"/>
      providers>
    siteMap>
 system.web>
 <locationpath="Admin">
    <system.web>
      <authorization>
        <allowroles="Administrators"/>
        <denyusers="*"/>
      authorization>
    system.web>
 location>
 <locationpath="Family">
    <system.web>
      <authorization>
        <allowroles="Administrators,Family" />
        <denyusers="*" />
      authorization>
    system.web>
 location>
 <locationpath="Authours">
    <system.web>
      <authorization>
        <allowroles="Administrators,Authour" />       
        <denyusers="*" />
        <denyusers="?" />
      authorization>
    system.web>
 location>
 <locationpath="Friends">
    <system.web>
      <authorization>      
        <denyusers="?" />
      authorization>
    system.web>
 location>
 <locationpath="Members">
    <system.web>
      <authorization>
        <denyusers="?" />
      authorization>
    system.web>
 location>
 <system.net>
    <mailSettings>
      <smtpdeliveryMethod="network">
        <networkhost="host IP or name"
                 userName="email address"
                 password="password" />               
      smtp>
    mailSettings>
 system.net>
configuration>
Visitors/Readers Comments
(for questions please use The Forum)



Amol Kagde
hi!

This is very helpful web config article .
my question is the "How to add or save location in web.config file through code in c#?"
if u will please help me?
Thank you! in advance.
ok.

21/07/2008 00:17:46 UTC

durgesh
 good for us.......

15/11/2008 00:18:48 UTC




Add your Comments

Name:  
Message:
Note: For faster response please use Forums >> for your questions instead of the comments area! (Admin)