How many web.config files that can be there an ASP.NET application?

Posted by Karam under ASP.NET on 8/23/2011 | Points: 10 | Views : 9569 | Status : [Member] | Replies : 5
As much as I know there can be only One web.config file in one ASP.NET application,But it is not always true,it depends on directories or folders something ........Is there anybody can clear me all this, If i am not wrong ?

Karam


Responses

Posted by: Vuyiswamb on: 8/23/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
You can have more than one web config in one asp.net application , but it is not advisable to do such a thing, most people that do that , end up with the problem of one config overriding another config.



Thank you for posting at Dotnetfunda
[Administrator]

Karam, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karam on: 8/23/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Vuyiswamb ,

In what cases there is a need to use more than one web.config file in one ASP.net application?

Thanks,

Karam

Karam, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karam on: 8/23/2011 [Member] Starter | Points: 25

Up
0
Down
I also want to ask mostly this question is asked in MCQ so what is the right answer means Should we say there may be more than one web.config files in one application or there is a limit of number of web.config files that the application can have?

Karam

Karam, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 8/23/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
i dont think there is a limit , but one should be enough.



Thank you for posting at Dotnetfunda
[Administrator]

Karam, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Harikatakam on: 8/24/2011 [Member] Starter | Points: 25

Up
0
Down
Dear Karam,

Usuallay we will have more than web.config files in the cases where we need to give differend kind of authorization for different users.

Consider a scernario you have one website ,inside that you have 5 resourses(usually aspx pages) as below

1. welcome .aspx
2.usermanagement.aspx
3.home.aspx
4.courses.aspx
5.facultyDetails.aspx

in this case you would like to give the access of
usermanagement.aspx to only admin users
courses.aspx,facultyDetails.aspx to only registerd users
welcome .aspx,home.aspx to all users

so inorder to acheive this ,what we will do is

we will create 2 folders like
1.Admin
2.RegisteredUSer

then we need to place usermanagement.aspx in admin folder as add a web.config in this folder and in that file we can authorize the only admin users.
we need palce courses.aspx,facultyDetails.aspx in RegisteredUSer folder as add a web.config in this folder and in that file we can authorize the only registered users.

rest of tjhe pages we can place in root folder itself.



Karam, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response