Mega Code Archive

 
Categories / ASP.Net Tutorial / Configuration
 

Applying Configuration Settings to a Particular Path

By default, the settings in a Machine.config or Web.config file are applied to all pages in the same folder and below.  You can apply configuration settings to a particular path.  You apply configuration settings to a particular path by using the <location> element.  For example, the following web configuration file enables password-protection for a single file named Secret.aspx. The <location> element must be added as an immediate child of the <configuration> element.  File: Web.config <configuration >   <system.web>     <authentication mode="Forms" />   </system.web>   <location path="Secret.aspx">     <system.web>       <authorization>         <deny users="?" />       </authorization>     </system.web>   </location> </configuration>