Page 140 - DCAP312_WEB_TECHNOLOGIES_II
P. 140
Web Technologies-II
Notes C#
String star Connection;
STR Connection = Configuration Settings .App Settings[
“ConnectionString1”];
Response .Write (star Connection);
In ASP
We need to iterate through the nodes in web .comfit.
VBscript
set xml doc=server .Create Object( “Microsoft. XMLDOM”)
set xml app Settings=server .Create Object( “Microsoft .XMLDOM”)
set xml add=server. Create Object( “Microsoft .XMLDOM”)
xml Doc .a sync= “false”
xml Doc .load(server Map Path ( “web comfit”))
Set xml app Settings = xml doc .Get Elements By Tag Name( “app
Settings”).Item(0)
Set xml add = xml app Settings. Get Elements by Tag Name(“add”)
For each x in xml add
‘Check for the Attribute Value
If x .get Attribute(“key”) = “ConnectionString1” then
Response.write(x .get Attribute (“value”))
End if
Next
7.2 ASP.NET Web.Configuration File
ASP.Net Applications of XML have been integrated into such an extent that XML format for
the exchange of data, it is also used to store
1. A Web application can contain more than one file. The settings in a file apply to the directory
in which it is located, and all child directories. Web .comfit files in child directories take
precedence over the settings that are specified in parent directories.
2. Web .comfit files are protected by IIS, so clients cannot get to them. If we try to retrieve
an existing http://?Com/Web.config file, we will be presented with an “Access denied”
error message.
3. IIS monitors the Web .comfit files for changes and caches the contents for performance
reasons. There is no need to restart the Web server after we modify a Web. Configuration
file.
Configuration settings for any of our ASP.NET Web applications can be stored in a simple text
file. Presented in an easily understandable XML format, this file, called Web. Configuration can
contain application-wide data such as database connection strings, custom error messages, and
culture settings. The Web .comfit is an XML file, it can consist of any valid XML tags, but the
root element should always be <configuration>. Nested within this tag we can include various
other tags to describe our settings. Since a Web. Comfit file comes as a standard when we start
to build a new Web application.The default XML file generated by Visual Studio .NET:
<?xml version= “1.0” encoding= “utf-8” ?>
134 LOVELY PROFESSIONAL UNIVERSITY