Configuration in ASP.Net Assignment Help

Assignment Help: >> ASP.Net Programming >> Configuration in ASP.Net

Configuration in ASP.Net:

The nature of an ASP.Net application is reflected by different aspects in the configuration files:

  • machine.config
  • web.config

The machine.config file has default and the machine-specific value for all related settings. The machine settings are accessed by the system administrator and applications are usually not provided access to this file.

An application however, may override the default values by preparing web.config files in its roots folder. The web.config file is a part of the machine.config file.

If the application has child directories, it may define a web.config file for every folder. Scope of every configuration file is calculated in a hierarchical top-down manner.

Any web.config file may locally extend, override or restrict any settings declared on the upper level.

Visual Studio creates a default web.config file for every project. An application may run without a web.config file, however, you may not debug an application without a web.config file.

The subsequent figure denotes the Solution Explorer for the sample example needed in the web application tutorial:

1098_configuration.png

In this service there are two web.config files for two projects i.e., the web service and the web site naming the web service.

The web.config file has the configuration component as the root node. data under this component is grouped into two main types: the configuration section-handler defines area, and the configuration part settings area.

The subsequent code snippet denotes the basic syntax of a configuration file:

<configuration>

  <!-- Configuration section-handler declaration area. -->

  <configSections>

    <section name="section1" type="section1Handler" />

    <section name="section2" type="section2Handler" />

  </configSections>

  <!-- Configuration section settings area. -->

  <section1>

    <s1Setting1 attribute1="attr1" />

  </section1>

  <section2>

    <s2Setting1 attribute1="attr1" />

  </section2>

  <system.web>

    <authentication mode="Windows" />

  </system.web>

</configuration>

The Configuration Section Handler declarations:

The configuration section handlers are calculated within the <configSections> tags. Each configuration handler denotes name of a configuration section, having within the file, which gives some configuration data. It has the subsequent basic syntax:

<configSections>

   <section />

   <sectionGroup />

   <remove />

   <clear/>

</configSections>

It has the following elements:

  • Clear - it eliminates all references to inherited sections and section groups.
  • Remove - it eliminates a reference to an inherited section and section group.
  • Section - it describes an association between a configuration section handler and a configuration element.
  • Section group - it describes an association between a configuration section handler and a configuration section.

The Application Settings:

The application settings provide storing application-wide name-value pairs for read-only access. For example, you may provide a custom application setting as:

<configuration>

   <appSettings>

      <add key="Application Name" value="MyApplication" />

   </appSettings>

</configuration>

For example, you can store the name of a book and its ISBN number:

<configuration>

   <appSettings>

      <add key="appISBN" value="0-273-68726-3" />

      <add key="appBook" value="Corporate Finance" />

   </appSettings>

</configuration>

The Connection Strings:

The connection strings denotes which database connection strings are available to the website. For example:

<connectionStrings>

   <add name="ASPDotNetStepByStepConnectionString"

        connectionString="Provider=Microsoft.Jet.OLEDB.4.0;

        Data Source=E:\\projects\datacaching\ /

        datacaching\App_Data\ASPDotNetStepByStep.mdb"

        providerName="System.Data.OleDb" />

   <add name="booksConnectionString"

        connectionString="Provider=Microsoft.Jet.OLEDB.4.0;

        Data Source=C:\ \databinding\App_Data\books.mdb"

   providerName="System.Data.OleDb" />

</connectionStrings>

The System.Web Element:

The system.web component shows the root component for the ASP.NET configuration section and contains configuration components that configure ASP.NET Web applications and control how the applications act.

It takes most of the configuration component needed to be adjusted in common applications. The basic syntax for the element:

<system.web>

   <anonymousIdentification>

   <authentication>

   <authorization>

   <browserCaps>

   <caching>

   <clientTarget>

   <compilation>

   <customErrors>

   <deployment>

   <deviceFilters>

   <globalization>

   <healthMonitoring>

   <hostingEnvironment>

   <httpCookies>

   <httpHandlers>

   <httpModules>

   <httpRuntime>

   <identity>

   <machineKey>

   <membership>

   <mobileControls>

   <pages>

   <processModel>

   <profile>

   <roleManager>

   <securityPolicy>

   <sessionPageState>

   <sessionState>

   <siteMap>

   <trace>

   <trust>

   <urlMappings>

   <webControls>

   <webParts>

   <webServices>

   <xhtmlConformance>

</system.web>

The following table provides brief description of some of common sub elements of thesystem.web element:

anonymousIdentification:

This is needed to identify users who are not authenticated when authorization is needed.

authentication:

It configures the authentication process. Basic syntax:

<authentication mode="[Windows|Forms|Passport|None]">

   <forms>...</forms>

   <passport/>

</authentication>

authorization

It configures the authorization process.Basic syntax:

<authorization>

   <allow .../>

   <deny .../>

</authorization>

caching:

Configures the cache function.Basic syntax:

<caching>

   <cache>...</cache>

   <outputCache>...</outputCache>

   <outputCacheSettings>...</outputCacheSettings>

   <sqlCacheDependency>...</sqlCacheDependency>

</caching>

customErrors:

Describes custom error messages. Basic syntax:

<customErrors defaultRedirect="url" mode="On|Off|RemoteOnly">

     <error. . ./>

</customErrors>

deployment:

Describes configuration settings used for deployment. Basic syntax:

<deployment retail="true|false" />

hostingEnvironment:

Defines configuration settings for hosting environment.Basic syntax:

<hostingEnvironment

    idleTimeout="HH:MM:SS"

    shadowCopyBinAssemblies="true|false"

    shutdownTimeout="number"

    urlMetadataSlidingExpiration="HH:MM:SS"

/>

identity:

Configures the checking of the application. Basic syntax:

<identity impersonate="true|false"

          userName="domain\username"

          password="<secure password>"/>

machineKey:

Configures keys to need for decryption and encryption of Forms authentication cookie data.

It also provides configuring a validation key that operates message authentication relates on view-state data and prepare authentication tickets. Basic syntax:

<machineKey

  validationKey="AutoGenerate,IsolateApps" [String]

  decryptionKey="AutoGenerate,IsolateApps" [String]

  validation="HMACSHA256" [SHA1 | MD5 | 3DES | AES | HMACSHA256 |

    HMACSHA384 | HMACSHA512 | alg:algorithm_name]

  decryption="Auto" [Auto | DES | 3DES | AES | alg:algorithm_name]

/>

membership:

This configures parameters of organizing and authenticating user accounts.Basic syntax:

<membership

    defaultProvider="provider name"

    userIsOnlineTimeWindow="number of minutes"

    hashAlgorithmType="SHA1">

    <providers>...</providers>

</membership>

pages:

Gives page-specific configurations. Basic syntax:

<pages    

   asyncTimeout="number"

   autoEventWireup="[True|False]"

   buffer="[True|False]"

   clientIDMode="[AutoID|Predictable|Static]"

   compilationMode="[Always|Auto|Never]"

   controlRenderingCompatibilityVersion="[3.5|4.0]"

   enableEventValidation="[True|False]"

   enableSessionState="[True|False|ReadOnly]"

   enableViewState="[True|False]"

   enableViewStateMac="[True|False]"

   maintainScrollPositionOnPostBack="[True|False]"

   masterPageFile="file path"

   maxPageStateFieldLength="number"

   pageBaseType="typename, assembly"

   pageParserFilterType="string"

   smartNavigation="[True|False]"

   styleSheetTheme="string"

   theme="string"

   userControlBaseType="typename"

   validateRequest="[True|False]"

   viewStateEncryptionMode="[Always|Auto|Never]"

   <controls>...</controls>

   <namespaces>...</namespaces>

   <tagMapping>...</tagMapping>

   <ignoreDeviceFilters>...</ignoreDeviceFilters>

</pages>

profile:

Configures user profile parameters. Basic syntax:

<profile

    enabled="true|false"

    inherits="fully qualified type reference"

    automaticSaveEnabled="true|false"

    defaultProvider="provider name">

    <properties>...</properties>

    <providers>...</providers>

</profile>

roleManager:

Configures settings for user aspect. Basic syntax:

<roleManager

    cacheRolesInCookie="true|false"

    cookieName="name"

    cookiePath="/"

    cookieProtection="All|Encryption|Validation|None"

    cookieRequireSSL="true|false "

    cookieSlidingExpiration="true|false "

    cookieTimeout="number of minutes"

    createPersistentCookie="true|false"

    defaultProvider="provider name"

    domain="cookie domain">

    enabled="true|false"

    maxCachedResults="maximum number of role names cached"

    <providers>...</providers>

</roleManager>

securityPolicy:

Configures the security type policy. Basic syntax:

<securityPolicy>

   <trustLevel />

</securityPolicy>

urlMappings:

Creates the mappings for hiding the real URL and giving a more user friendly URL. Basic syntax:

<urlMappings enabled="true|false">

    <add.../>

    <clear />

    <remove.../>

</urlMappings>

webControls:

It gives the name of shared location for client scipts. Basic syntax:

<webControls clientScriptsLocation="String" />

webServices:

This configures the web services.

Email based ASP.Net assignment help - homework help at Expertsmind

Are you searching ASP.Net expert for help with Configuration in ASP.Net questions?  Configuration in ASP.Net topic is not easier to learn without external help?  We at www.expertsmind.com offer finest service of ASP.Net assignment help and ASP.Net homework help. Live tutors are available for 24x7 hours helping students in their Configuration in ASP.Net related problems. Computer science programming assignments help making life easy for students. We provide step by step Configuration in ASP.Net question's answers with 100% plagiarism free content. We prepare quality content and notes for Configuration in ASP.Net topic under ASP.Net theory and study material. These are avail for subscribed users and they can get advantages anytime.

Why Expertsmind for assignment help

  1. Higher degree holder and experienced experts network
  2. Punctuality and responsibility of work
  3. Quality solution with 100% plagiarism free answers
  4. Time on Delivery
  5. Privacy of information and details
  6. Excellence in solving ASP.Net queries in excels and word format.
  7. Best tutoring assistance 24x7 hours

 

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd