Search

Tuesday, March 31, 2015
0 comments

Can we take multiple web.config files in single asp.net application

10:59 AMTuesday, March 31, 2015
Yes,  we can take multiple web.config files in the single asp.net application. If we have a single directory then we can add multiple config file with different name. If you want to access xml tag from config file then you can access only web.config file elements. Lets take an simple example of the file.


web.config file

<configuration>
  <appSettings>
    <add key="first" value="My first web.config file"/>   
    
  </appSettings>
</configuration>

Default.aspx file

    <asp:Label ID="Label1" runat="server" Text="<%$appSettings:first%>"></asp:Label> 

Its working fine, but when we take another config file in the application then get the error like file not found error. So, i have a solution of this problem. Follow the mentioned steps to overcome this problem:
Step-1 : Add a new directory in the solution(application)
Step-2 : Add new web.config file in the newly created directory.
Step-3 : Also add a web form in the directory.
Step-4 : Now, you can easily access web.config file which is available in the newly created directory.
Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top