is it possible to set web.config's locations in code? would it be custom .config?

Hi!

I was wondering if there's any way to set locations in code?

I am aware of roles / memberships etc., but the underlying method which I have seen used still comes down to setting everything with web.config.

Perhaps you have come across a custom .config setup? How would that work?

I am using 2.0 framework - C# or VB. 

Many thanks!

Dmitri

0
dreche
9/16/2007 7:32:54 AM
asp.net.config-deploy 12495 articles. 0 followers. Follow

1 Replies
773 Views

Similar Articles

[PageSpeed] 41
Get it on Google Play
Get it on Apple App Store

I do that by referencing another config file from within web.config.  My syntax looks like this:

<connectionStrings configSource="WebConnectionStrings.config"></connectionStrings>

then, WebConnectionStrings.config:

<connectionStrings>
 <remove name="CodeCampSV06"/>
 <add name="CodeCampSV06"
   connectionString="Data Source=(local);Initial Catalog=codecampsv07;Persist Security Info=True;User ID=sa;Password=xxx"
   providerName="System.Data.SqlClient"/>
 <add name="CodeCampSV06FastTimeOut"
  connectionString="Data Source=(local);Connect Timeout=3;Initial Catalog=codecampsv07;Persist Security Info=True;User ID=sa;Password=xxx"
  providerName="System.Data.SqlClient"/>
</connectionStrings>

 


Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
0
pkellner
9/16/2007 1:22:25 PM
Reply:

Similar Artilces:

How do I merge web services' app.config with web app's web.config? Help!!
I have a web application project that uses a separate class library containing web service references (service layer). I want to be able to configure the web reference URLs dynamically and I know you can set this up by setting the URL behavior to  'Dynamic', etc, etc. The problem is VS2005 puts the URLs in the project's app.config file. When the class library becomes a DLL component, I have no way of accessing the app.config file.Is there a way to make the web reference project to look for the URLs in the web.config instead of its app.config? Or is there a way to merge this app.config w...

Isolating web.config from it's parent web.config
I need to run an application withing a sub-directory of another application. Basically, I need to install an old version of DNN as a subdirectory of a current DNN2 installation. I get a problem of conflicting web.configs. The subdirectory want to use it's parent directory's web.config file. I thought by making the subdirectory an "application" in IIS that it would use the web.config in it's own folder but instead, it is referenceing the web.config file from it's parent. Any thoughts or help would be appreciated. Thanks, Stef. Stef, Because of the hierarchical nat...

how to let the web.config in the sub-directory to NOT to inherited from Root's web.config.
Hi,all,   How to let the sub-directory to avoid the authentication control from Root's webconfig? I heard that we can add a new web.config to the sub-directory. And then we can slove the problem.   Virtual directory is :http://localhost/main   Sub-directory is : http://localhost/main/reminder   My application used the Forms Authentication, then all files in every directory is controlled by the Forms Authentication. But now i want a sub-directory to avoid this. (user can access this directory directly, Needn't to Login.)   In my application, the user can ac...

Web.Config
Hello, I am in .NET 1.1 I have a custom.config to overwrite my web.config file and I would like to centralize the configuration like:is it possible top have several path for the custom files? <files path="~/custom_standard/">    <file ..../> </files> <files path="/custom_specific/">    <file.../> </files> or <files path="~/custom_standard/">    <file ..../> <path="/custom_specific/">    <file.../> </files>   ThanksDom If you...

After migration from .Net 1.1 to .Net 3.5 do I have to incorporate new web.config settings in old *.config file
Hi,I have successfully migrated web application from .Net 1.1 to .Net 3.5. Could you let me know whether I have to incorporate setting in new web.config (this new web.config file was generated automatically due to migration) into old *.config file?FYI: Old *.config file contains all application level settings required. So I will continue to use old.config file by removing new web.config file. Settings which are in new web.config file are:<configSections><sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup,...

Interop reads machine.config but not site's web.config
I created some server web controls, registered in the GAC, and stored their settings in the web.config in the root of the site.  To avoid having to maintain multiple copies of code for supporting an ASP/ASP.NET environment, I created an interop.  When I used the interop in ASP, it was unable to read the settings stored in the site's web.config; I had to move them to the machine.config.  Is there a way around this default bevahior? Any help would be much appreciated! Thanks!   meh...I figured it out. I just had to use OpenWebConfiguration and spec...

what's the difference in configing web.config with SQL Server and MSDE?
I always get mistakes alert. And how to install MS SQL Server 2000 to a windows server 2003, I encount incompatible problem.thanks...

running 2 web.configs in the same website 1 in /web.config and one in /swf/web.config
Im having issues doing this. and when i remove the authentication from the swf/web.config it still doesnt seem to be applying to the child website at all. Whats the proper way to set a child website? Thanks!!  The lower most web.config overrides all previous settings. So if you remove the section from the /swf/web.config whatever settings you have in the web.config in the next higher level will have an effect on the content of the child folder.So instead of removing a section, try giving appropriate settings in the /swf/web.config....

How to config web.config location path?
 I know I can use the code below in web.config to cnofiguration the role permission for Content.aspx page. The problem I have is that this page have diffrent permission with diffrent id parameters. Content.aspx?id=1 can only be accesed by super admin,  Content.aspx?id=3 can only be accessed by patient, etc. 1 2 <configuration> 3 <location path="Content.aspx"> 4 <system.web> 5 <authorization> 6 <allow users="*"/> 7 </authorization> 8 </system.web> 9 &l...

Need to put this in a web.config file. Transfer a collection from app.config to web.config.
<!--<setting name="Groups" serializeAs="Xml"> <value> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <string>GL CA Corporate Data</string> <string>GL CONT Contractors</string> <string>GL IT SolutionDelivery</string> </ArrayOfString> </value> </setting>-->   I need to put this in the below web.config.<?xml version="1.0"?><!-- Note: As an alternative to hand editing this fi...

Web Deployment Project - Config Properties
I'm using a Web Deployment Project to compile my web site. In the Property Pages - Configuration Properties - Deployment section, there is an option to 'Enable Web.config file section replacement'. I have this working to replace certain sections of my web.config for each build config (release/staging/dev). I think this makes sense so other developers do not have to remember to change the web.config file. HOWEVER, this only seems to work when replacing parts of web.config; such as appSettings, connectionString, etc. This would require me to have separate config files for each section and bui...

When I decrypt a web.config using C# code, all the settings are 'gone'
Hello, I've created a mini .net application that will encrypt and decrypt web.config files for my client.  I've spent a few days trying to figure out WHY when the file gets decrpyted, all the appSettings are no longer there.  I am guessing that they should be restored to the original content. I am using the following code: 1    Configuration objConfig = WebConfigurationManager.OpenWebConfiguration(GetVirtualPath(_strAppPath));2    AppSettingsSection objAppsettings = (AppSettingsSection)objConfig.GetSection("appSettings");3 &nb...

Read info from web.config, machine.config, app.config....
I know how to read info from the web.config, see code:  Protected path As String = "/Framework" Protected config As Configuration = WebConfigurationManager.OpenWebConfiguration(path) How can I read also the data from machine.config and other config files, like the app.configs?Johan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================Please mark the most helpful reply/replies as "Answer". ...

app.config and web.config deployments and installers
I use web deployment projects for changing web.config values based on the configuration build types I have setup (dev/test/stage/prod) and it works excellent for building installers in multiple environments.  Now, I am trying to do the same the Windows Applications.  How can I automate the changing of app.config values based on the build configuration (dev/test/stage/prod)?  Any help would be much appreciated. Thanks,Chris...

Web resources about - is it possible to set web.config's locations in code? would it be custom .config? - asp.net.config-deploy

Resources last updated: 12/22/2015 2:20:45 AM