Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
0Activity
0 of .
Results for:
No results containing your search query
P. 1
ASP Webconfig Full

ASP Webconfig Full

Ratings: (0)|Views: 0 |Likes:
Published by aravindwin
Full
Full

More info:

Published by: aravindwin on Feb 26, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

02/26/2013

pdf

text

original

 
ASP.NET Web.config File
ASP.NET Configuration, Authentication, authorization, compilation, customErrors, DataBinding, globalization, Handler, httpRuntime, Interface, Structure, Web.config | 3 commentsASP.Net Applications of XML have been integrated into such an extent that XML format for theexchange of data, it's also used to store configuration settings.  1.
 
A Web application can contain more than one Web.config file. The settings in a file apply to the directory in which it's located, and all child directories. Web.config files inchild directories take precedence over the settings that are specified in parent directories.2.
 
Web.config files are protected by IIS, so clients cannot get to them. If you try to retrievean existing http://?????.com/Web.config file, you'll be presented with an "Access denied"error message.3.
 
IIS monitors the Web.config files for changes and caches the contents for performancereasons. There's no need to restart the Web server after you modify a Web.config file.Configuration settings for any of your ASP.NET Web applications can be stored in a simple textfile. Presented in an easily understandable XML format, this file, called Web.config, can containapplication-wide data such as database connection strings, custom error messages, and culturesettings.The Web.config is an XML file, it can consist of any valid XML tags, but the root elementshould always be <configuration>. Nested within this tag you can include various other tags todescribe your settings. Since a Web.config file comes as a standard when you start to build a newWeb application.The default XML file generated by Visual Studio .NET:<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilationdefaultLanguage="c#" debug="true"  /> <customErrorsmode="RemoteOnly" /><authentication mode="Windows" /><authorization> <allow users="*" /> </authorization> <trace enabled="false" requestLimit="10" pageOutput="false" 
 
traceMode="SortByTime" localOnly="true"  /> <sessionStatemode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false"timeout="20" /> <globalizationrequestEncoding="utf-8"responseEncoding="utf-8" /> </system.web> </configuration> The <configuration> tag has only one child tag, which we call section group, the <system.web>tag. A section group typically contains the setting sections, such as: compilation, customErrors,authentication, authorization, etc. The way this works is pretty straightforward: you simplyinclude your settings in the appropriate setting sections. You want to use a differentauthentication mode for your Web application, you'd change that setting in the authenticationsection.Apart from the standard system.web settings, you can define your own specific applicationsettings, such as a database connection string, using the <appSettings> tag. Consequently, yourmost common Web.config outline would be:<configuration> <system.web> <!
 — 
sections--></system.web> <appSettings> <!
 — 
sections --></appSettings > </configuration> Let's discuss the details of both section groups now.The system.web Section GroupIn this section group, you'll include configuration settings that, you'd have set up somewhere inthe IIS administration console. At Microsoft's MSDN Library, you can find an overview of allthe tags that the system.web section group understands, but, depending on the complexity of your site, you may not ever use even half of those options.
 
 
<authentication>
 The authentication section controls the type of authentication used within your Web application,as contained in the attribute mode. You'll enter the value "None" if anyone may access yourapplication. If authentication is required, you'll use "Windows", "Forms" or "Passport" to definethe type of authentication. For example:<authentication mode="Windows" /> 
<authorization>
 To allow or deny access to your web application to certain users or roles, use <allow> or <deny>child tags.<authorization> <allow roles="Administrators,Users" /> <deny users="*" /> </authorization> It's important to understand that ASP.NET's authorization module iterates through the sections,applying the first rule that corresponds to the current user. In this example, users carrying therole Administrators or Users will be allowed access, while all others (indicated by the *wildcard) will encounter the second rule and will subsequently be denied access.
<compilation>
 Here, you can configure the compiler settings for ASP.NET. You can use loads of attributeshere, of which the most common are debug and defaultLanguage. Set debug to "true" only if youwant the browser to display debugging information. Since turning on this option reducesperformance, you'd normally want to set it to "false". The defaultLanguage attribute tellsASP.NET which language compiler to use, since you could use either Visual Basic .NET or C#for instance. It has value vb by default.
<customErrors>
 To provide your end users with custom, user-friendly error messages, you can set the modeattribute of this section to On. If you set it to RemoteOnly, custom errors will be shown only toremote clients, while local host users will see the ugly but useful ASP.NET errors -- clearly, thisis helpful when debugging. Setting the mode attribute to Off will show ASP.NET errors to allusers.If you supply a relative (for instance, /error404.html) or absolute address(http://yourdomain.com/error404.html) in the defaultRedirect attribute, the application will beautomatically redirected to this address in case of an error. Note that the relative address is

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->