web config

Post on 21-Aug-2015

532 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

By Dipali Shiledar

XML file Configuration Information of the

Web Application Important root tag element is

<configuration> It is protected by IIS

Control Module Loading Security Configuration Session State Configuration Application Language Settings Compilation Settings Database Connection Strings

Better advantages over Machine.config

If Web.config file is changed, there is no need to re-compile the application

Web.config file cannot be viewed in directly in a browser

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

</configuration>

1) <system.web> Only child of the <configuration> tag Consists of setting sections such as:

custom errors, compilation, authentication, authorization

   <authentication mode="Windows" />    <authorization> 

       <allow roles="Administrators,Users" />   </authorization>

2) <appSettings> Stores specific application settings

such as database connection strings <appSettings>

<add key="sConnectionString" value="Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog=Your_Database_Name;User Id=Your_Username;Password=Your_Password;" /></appSettings>

ConfigurationSettings.AppSettings("sConnectionString")

3) <customErrors> It the settings for handling web

application errors <customErrors

defaultRedirect="YourDefaultURL" mode="On|Off|RemoteOnly"><error statusCode="ErrorStatusCode" redirect="YourRedirectURL"/></customErrors> 

It can handle particular error code

4) <identity> It defines what identity to use

when accessing the ASP.NET application

<identity impersonate="true|false" userName="username" password="password"/> 

You should always specify username and password

5) <trace> Web applications trace log is

stored in application root folder as trace.axd

<trace enabled="true" localOnly="true" pageOutput="false" />

You can change the display of tracing information in the trace section.

6) <sessionState> It tell ASP.NET where to store

the session state    <sessionState mode="InProc"

/> It is a server side state. Information is lost when the

ASP.net process crashes and sessions become useless in Web forms

THANK YOU

top related