0% found this document useful (0 votes)
72 views

Web Configuration File

A web configuration file is used to manage various settings that define a website such as database connections, caching settings, session states, error handling, and security. The configuration file is an XML file separate from application code. To create a web configuration file, a new text file is made and saved as webconfig.conf. The file is then added to the website created in Visual Studio.Net. Settings in the file can then be changed by opening it in a text editor. The sample code provided shows connection strings for two databases along with compilation and authentication settings.

Uploaded by

Naveenesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Web Configuration File

A web configuration file is used to manage various settings that define a website such as database connections, caching settings, session states, error handling, and security. The configuration file is an XML file separate from application code. To create a web configuration file, a new text file is made and saved as webconfig.conf. The file is then added to the website created in Visual Studio.Net. Settings in the file can then be changed by opening it in a text editor. The sample code provided shows connection strings for two databases along with compilation and authentication settings.

Uploaded by

Naveenesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

EXERCISE 1 : WEB CONFIGURATION FILE

AIM : To Create a webconfiguration file and use it in ASP.NET Web Site.

EXPLANATION:
Configuration file is used to manage various settings that define a website. The
settings are stored in XML files that are separate from the application code.

Generally a website contains a single Web.config file stored inside the application
root directory. However there can be many configuration files that manage settings at
various levels within an application.

Some of the most frequently used configurations, stored conveniently inside


Web.config file are:
• Database connections
• Caching settings
• Session States b5 17 46
• 181 23 70
• Error Handling
• Security
• Details of user controls and custom controls used in project

STEPS:

Step 1 : Create a New Text file using Notepad (or any text editor)
Step 2 : Create a Xml file as in the following source code
Step 3 : Save the file as webconfig.conf
Step 4 : Add the webconfig file to the website created using Visual Studio.Net
Step 5 : For changes in the webconfig file, Open the file in Text Editors (Notepad,
Wordpad etc.) and make necessary changes.

F:\Jerald\WebApp\Ex 1 Dr.M.Paul Arokiadass Jerald Page 1 of 2


SOURCE CODE :
<?xml version="1.0"?>
<!-- For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433 -->
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS; Integrated Security=SSPI;
AttachDBFilename=|DataDirectory| aspnetdb.mdf;User Instance=true"
AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User
providerName="System.Data.SqlClient" />
<add name="courseConnectionString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=&quot;F:
urce=&quot;F:\Jerald\WEB APPLICATIONS\db\course.mdb&quot;"
course.mdb&quot;"
providerName="System.Data.OleDb" />
<add name="courseConnectionString2"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=&quot;F:
Source=&quot;F:\Jerald\WEB APPLICATIONS\db\course
course.mdb&quot;"
providerName="System.Data.OleDb" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
</authentication>

</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

OUTPUT

F:\Jerald\WebApp\Ex 1 Dr.M.Paul Arokiadass Jerald Page 2 of 2

You might also like