Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2006, 09:46 PM
Registered User
 
Join Date: Mar 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default configure web.config (db details) when deploy app?

Feel its weired hardcode database details in web.config, according to my client, web.config automatically direct to the respective server database when deploy asp.net application. i have a custom db installer class which lets the user to keyin database server, db name, username and password when deploy. but how to make this to update web.config??.


 
Old June 7th, 2006, 11:57 AM
Authorized User
 
Join Date: May 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to notrosh
Default

Hi,

Probably something to do with the <connectionStrings> region in your web.config...

 
Old June 7th, 2006, 12:10 PM
Authorized User
 
Join Date: Apr 2006
Posts: 79
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via AIM to anujrathi Send a message via MSN to anujrathi Send a message via Yahoo to anujrathi
Default

Hi u can specify ur connection string in web.config, so that u can make any change any time, without recompile ur application. bcoz it is purely XML file.

Add the following section in web.config:

<appsettings>
<add key="ConnectionString" value="server=UrServerName;database=UrDatabaseName ;uid=UserName;pwd=Pasword" />
</appsettings>


 
Old June 7th, 2006, 09:27 PM
Registered User
 
Join Date: Mar 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi anuj and notrosh

yes its exactly connection string , no doubt, but how to update the servername ("UrServerName"), databasename(UrDatabaseName), uid and pwd from the deployment screen(where the user keyin when i deploy my asp.net application) to the connection string which i have given as same as anuj has written ie
<appsettings>
<add key="ConnectionString" value="server=UrServerName;database=UrDatabaseName ;uid=UserName;pwd=Pasword" />
</appsettings>

meaning i dont want to manually change web.config file when i deploy in different server.

in that case
isit possible to keep servername,dbname,uid and pwd as variable and get it from the db installer class(db installer class is a project inside my application solution which interfaces with the websetup project inside my application and generate a user interface screen for user to keyin database infos)?.

or whats the best way to make this possible?

thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
web.config vs. app.config darlo Visual Studio 2005 11 August 20th, 2008 07:23 AM
How to get the directory of app.config cczhangjm C# 2 May 28th, 2007 02:55 AM
How to access app.config in C# ? cczhangjm XML 2 May 16th, 2007 07:43 PM
Chapter 8 - app.config jotto BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 2 March 21st, 2006 05:31 PM
Best way to bind config data to a web app psantos Pro JSP 2 October 21st, 2003 06:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.