Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi there,
 
what i want is a application can have multiple web.config.
 
suppose a config file for INDIA
a config file for Germany.
 
like that.
suppose india person logs in India config file should load
and if german person logs in Germany config file should load
 
is this possible
 
please help
Posted 5-Sep-12 1:17am
Edited 5-Sep-12 2:19am
v3
Comments
manognya kota at 5-Sep-12 6:21am
   
Hi,
 
I guess the similar is posted here. http://www.codeproject.com/Questions/453447/Differentiating-between-two-connection-string? Please do not post the question twice.Instead use improve question.
suhailnoorpawane at 5-Sep-12 6:28am
   
My friend if you have understood the question.
This is about different config file and the one you posted is about different connection.
Have a look.
Thanks
Sandeep Mewara at 5-Sep-12 6:43am
   
And what difference will be there in each config file? Just few config settings, right? Rest everything same? Why you need such implementation?
biswarup88 at 5-Sep-12 6:53am
   
Why do you want to load different config? is that because calculating that particular country's date time?
suhailnoorpawane at 5-Sep-12 7:12am
   
THEY WILL HAVE DIFFERENT DATABASE CONNECTION IN CONNECTIONSTRING WITH SIMILAR NAME
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Keep contry wise folders and put your config files in that and call upon so..
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

As you have mentioned
THEY WILL HAVE DIFFERENT DATABASE CONNECTION IN CONNECTIONSTRING WITH SIMILAR NAME
You can achieve that by putting the connectionstring in the resource file rather than web.config. the resource file will be loaded based on the culture and you can read the respective connectionstring from the resource file.
 
[edit]
 
You will have to create a global resource file. refer to following articles for the usage part.
http://msdn.microsoft.com/en-us/library/ms227427.aspx[^]
Using Globalization and Localization in ASP.NET[^]
  Permalink  
v2
Comments
suhailnoorpawane at 5-Sep-12 8:25am
   
so if once the resource file is loaded will it restart the application
suhailnoorpawane at 5-Sep-12 8:25am
   
can u show me how to do that if so please do the needfull
thanks
Rahul Rajat Singh at 5-Sep-12 8:31am
   
See some links in the answer(just updated)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

yes it is possible,
That you can have multiple web.config file in your project.
But in root folder you must have it only one and then create directories as per country and add another web.config file in particular directory.
 
And for peoples who are used it to login based on Authentication rule.Please look into this example.
Working with more than one Web.config file[^]
  Permalink  

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

  Print Answers RSS
0 Maciej Los 205
1 Richard MacCutchan 185
2 DamithSL 170
3 Tomas Takac 146
4 OriginalGriff 132
0 OriginalGriff 5,130
1 DamithSL 4,237
2 Maciej Los 3,700
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,846


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 5 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100