Create a Web.config File

Post date: Mar 1, 2011 6:49:59 AM

Create a Web.config File You can create a Web.config file by using a text editor such as Notepad. You must create a text

file that is named Web.config in the root directory of your ASP.NET application. The Web.config file must be a well-formed XML document and must have a format similar to the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\Machine.config file.

The Web.config file must contain only entries for configuration items that override the settings in the Machine.config file. At a minimum, the Web.config file must have the <configuration> element and the <system.web> element. These elements will contain individual configuration elements.

The following example shows a minimal Web.config file:

<?xml version="1.0" encoding="utf-8" ?> <configuration>   <system.web>    </system.web> </configuration> 

The first line of the Web.config file describes the document as XML-formatted and specifies the character encoding type. This first line must be the same for all .config files.

The lines that follow mark the beginning and the end of the <configuration> element and the <system.web> element of the Web.config file. By themselves, these lines do nothing. However, the lines provide a structure that permits you to add future configuration settings. You add the majority of the ASP.NET configuration settings between the <system.web> and </system.web> lines. These lines mark the beginning and the end of the ASP.NET configuration settings.

 <?xml version="1.0" ?>

 <!--

      Note: As an alternative to hand editing this file you can use the      web admin tool to configure settings for your application. Use     the Website->Asp.Net Configuration option in Visual Studio.     A full list of settings and comments can be found in      machine.config.comments usually located in      \Windows\Microsoft.Net\Framework\v2.x\Config  

  -->

  <configuration>

<!--

 Connection String for storing database details

  -->

<connectionStrings>

  <add name="passport" connectionString="server=.;Initial Catalog=passport;Integrated Security=True" providerName="System.Data.SqlClient" />

  </connectionStrings>

<system.web>

<!--

 Getting from machine.config.comment

  -->

 <membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15" hashAlgorithmType="">

<providers>

  <clear />

  <add connectionStringName="passport" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

  </providers>

  </membership>

<!--

 Role Manager

  -->

<roleManager enabled="true" cacheRolesInCookie="false" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" defaultProvider="AspNetSqlRoleProvider" createPersistentCookie="false" maxCachedResults="25">

<providers>

  <clear />

  <add connectionStringName="passport" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

  <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

  </providers>

  </roleManager>

<!--

 Site Management System

  -->

<siteMap defaultProvider="AspNetXmlSiteMapProvider" enabled="true">

<providers>

  <clear />

  <add securityTrimmingEnabled="true" siteMapFile="web.sitemap" name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

  </providers>

  </siteMap>

<!--

 Profile Management System

  -->

<profile enabled="true" defaultProvider="AspNetSqlProfileProvider" inherits="" automaticSaveEnabled="true">

<providers>

  <clear />

  <add connectionStringName="passport" applicationName="/" name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

  </providers>

<!--

Profile tyeps

  -->

<properties>

  <clear />

  </properties>

  </profile>

<!--

 End of Copy and Pasting

  -->

<!--

              Set compilation debug="true" to insert debugging              symbols into the compiled page. Because this              affects performance, set this value to true only              during development.         

  -->

<compilation debug="true" targetFramework="4.0">

<assemblies>

  <add assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

  <add assembly="CrystalDecisions.Shared, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

  <add assembly="CrystalDecisions.ReportSource, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

  <add assembly="CrystalDecisions.CrystalReports.Engine, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

  <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />

  <add assembly="CrystalDecisions.Enterprise.Framework, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />

  <add assembly="CrystalDecisions.Enterprise.InfoStore, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />

  <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />

  <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />

  </assemblies>

<buildProviders>

  <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

  </buildProviders>

  </compilation>

<!--

            The <authentication> section enables configuration              of the security authentication mode used by              ASP.NET to identify an incoming user.          

  -->

  <authentication mode="Forms" />

<!--

            The <customErrors> section enables configuration              of what to do if/when an unhandled error occurs              during the execution of a request. Specifically,              it enables developers to configure html error pages              to be displayed in place of a error stack trace.          <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">             <error statusCode="403" redirect="NoAccess.htm" />             <error statusCode="404" redirect="FileNotFound.htm" />         </customErrors>         

  -->

<httpHandlers>

  <add path="CrystalImageHandler.aspx" verb="GET" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />

  <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />

  </httpHandlers>

  <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />

  </system.web>

<!--

          The system.webServer section is required for running ASP.NET AJAX under Internet         Information Services 7.0.  It is not necessary for previous version of IIS.     

  -->

<system.webServer>

  <validation validateIntegratedModeConfiguration="false" />

<handlers>

  <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode" />

  </handlers>

  </system.webServer>

  </configuration>