Edit configuration of an ASP.NET application - ASP.NET (2024)

  • Article

This article describes how to edit the Web.config file of an ASP.NET application.

Original product version: ASP.NET
Original KB number: 815178

Summary

The Web.config file defines the behavior of ASP.NET applications. The Microsoft .NET Framework, including ASP.NET, uses XML-formatted .config text files to configure applications. This is a departure from conventional registry and metabase configuration mechanisms. Currently there's no Microsoft Management Console (MMC) snap-in or other Microsoft-provided administration tool for creating and for modifying .config files.

Add configuration settings to Web.config

Most ASP.NET applications come with a prebuilt Web.config file that can be edited with any text editor such as Notepad. Generally, Web.config files contain comments that make editing the file self-explanatory. However, you may have to add configuration items to a Web.config file that doesn't already have the configuration item defined. To add a standard configuration item to a Web.config file, follow these steps:

  1. Open the Machine.config file in a text editor such as Notepad.

    The Machine.config file is located in the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\ directory.

  2. In the Machine.config file, locate the configuration setting you want to override in your Web.config file. When the element is more than one line, the element starts with an <element_name> line, and ends with </element_name>. The element may also be self-closing and may look similar to <element_name attribute1='option' attribute2='option' />. White space is ignored. Therefore, the element may span multiple lines. The element may be preceded by a comment. The comment is contained inside<!-- and --> markings. The <trace> configuration element example that follows is an example of a self-closing element. The <trace> configuration element example has multiple attributes, spans multiple lines, and has a comment at the beginning.

    <!--trace Attributes: enabled="[true|false]" - Enable application tracing localOnly="[true|false]" - View trace results from localhost only pageOutput="[true|false]" - Display trace output on individual pages requestLimit="[number]" - Number of trace results available in trace.axd traceMode="[SortByTime|SortByCategory]" - Sorts trace result displays based on Time or Category --><trace enabled="false" localOnly="true" pageOutput="false" requestLimit="10" traceMode="SortByTime"/>
  3. Copy the whole configuration element and any beginning comment to the clipboard.

  4. Determine how the element is nested in the Machine.config file.

    The Machine.config file is hierarchical, and configuration elements are nested in other elements. When you copy a configuration element from the Machine.config file to the Web.config file, you must nest that configuration element in the same element that it was copied from. To determine the element of the Machine.config file that the configuration element is contained in, scroll up in the Machine.config file until you find an element that is opened, not closed. The containing element is simple to identify because higher-level elements have less indentation.

    Most ASP.NET configuration items are contained in the <system.web> element. The end of the element ( </system.web> ) must be placed after your configuration element.

    Note

    The element that your configuration element is contained in. You must paste that element in the same element in the Web.config file. A configuration element may be nested in multiple elements. You must create all higher-level elements in the Web.config file.

  5. Close the Machine.config file and then use your text editor to open the Web.config file in the root directory of your ASP.NET application.

  6. Paste the configuration element between the beginning and the end of the element that you identified in step 4.

    For example, if the configuration item is contained in the <system.web> element, the configuration item must be pasted immediately after the opening line of the <system.web> element and before the </system.web> closing line.

  7. Modify the configuration element in the Web.config file to override the Machine.config setting for that application.

    This setting applies to the folder that contains the Web.config file and all sub folders.

References

Edit configuration of an ASP.NET application - ASP.NET (2024)
Top Articles
Google cloud storage authentication
Capital One Wire Transfer: Transfer Time, Fees, and Limits | Instarem
Craigslist San Francisco Bay
Thor Majestic 23A Floor Plan
Hotels
Vaya Timeclock
Culver's Flavor Of The Day Wilson Nc
Polyhaven Hdri
Mohawkind Docagent
Bloxburg Image Ids
Jesus Revolution Showtimes Near Chisholm Trail 8
Progressbook Brunswick
Raid Guides - Hardstuck
Items/Tm/Hm cheats for Pokemon FireRed on GBA
Rosemary Beach, Panama City Beach, FL Real Estate & Homes for Sale | realtor.com®
Drago Funeral Home & Cremation Services Obituaries
Shreveport Active 911
978-0137606801
Sony E 18-200mm F3.5-6.3 OSS LE Review
Gon Deer Forum
Youravon Comcom
Webcentral Cuny
Vintage Stock Edmond Ok
Td Small Business Banking Login
Pickswise Review 2024: Is Pickswise a Trusted Tipster?
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Kohls Lufkin Tx
Foodsmart Jonesboro Ar Weekly Ad
Craigslist Fort Smith Ar Personals
Pioneer Library Overdrive
County Cricket Championship, day one - scores, radio commentary & live text
Fairwinds Shred Fest 2023
Bee And Willow Bar Cart
Frcp 47
Rochester Ny Missed Connections
Tiny Pains When Giving Blood Nyt Crossword
Shane Gillis’s Fall and Rise
All Characters in Omega Strikers
Umd Men's Basketball Duluth
Wilson Tire And Auto Service Gambrills Photos
Advance Auto.parts Near Me
Graduation Requirements
40X100 Barndominium Floor Plans With Shop
Fresno Craglist
Wild Fork Foods Login
Sleep Outfitters Springhurst
Dmv Kiosk Bakersfield
Parks And Rec Fantasy Football Names
Edict Of Force Poe
Att Corporate Store Location
Qvc Com Blogs
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 6794

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.