Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Centralize ASP.NET settings in one file

Total Hit ( 1794)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Although ASP.NET lets you distribute web.config files over all the application's subdirectories, it surely doesn't force you to do so. You can keep all the application settings in its main web.config file, while enforcing different settings on a directory-by-directory base, if you want. The key to this useful feature is the tag.

For example, let's see how an application's configuration file can specify different authorization settings for its different subdirectories. This web.config file enforces the same settings as the example seen in previous section:

Click here to copy the following block
<configuration>
 <system.web>
  <authorization>
   <allow roles="MyDomain\Administrator" />
   <deny users="*" />
  </authorization>
 </system.web>

 <location path="/Public">
  <system.web>
   <authorization>
    <allow users="?" />
   </authorization>
  </system.web>
 </location>
</configuration>

You can use a tag also in machine.config to affect settings in individual ASP.NET applications and their subdirectories. In this case, the path attribute must begin with the IIS site name, as read in the MMC snap-in. For example, here's how you can enable tracing for the .aspx files in the /MyApp virtual directory of the default Web site:

Click here to copy the following block
<location path="Default Web Site/MyApp">
 <system.web>
  <trace enabled="true" localOnly="true" pageOutput="true" />
 </system.web>
</location>



Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.