Click here to Skip to main content
15,916,949 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi this is lakshman, i want to use multiple web.config files in my web application. but here i am not sure it is possible, if possible how to assign a particular web.config file for the particular .aspx page.
Posted

The only way AFAIK is to keep them in different folders - each folder can have it's own web.config, and the settings are inherited downward where not overridden in the new.
This is normally used to restrict access to authorized persons:
default.aspx and Logon.aspx ate in the root
pages which need logged in users are in sub directories.
 
Share this answer
 
Comments
Manfred Rudolf Bihy 16-Sep-11 8:30am    
Purrrfect answer! 5+
You can not use multiple web.config files directly in single application.
If your application contains folders then you can use one web.config file for each folder along with web.config file in application.
 
Share this answer
 
Comments
lakshmanarao.vemula 16-Sep-11 8:52am    
K thx Salini.P if i have 2 or more web.config files in my application in some cases i want to assign a particular web.config file for Default.aspx, where can i change the code to take effect of changing the path of web.config files
P.Salini 17-Sep-11 2:00am    
We will use multiple web.config files in a application only when the application contains some pages which need authentication.

If that is your case then place all your secured pages in one folder,add a web.config file to that folder and then use forms authentication to authenticate users.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900