Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 8th, 2006, 10:00 AM
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 parameters in web.config

Is there any procedure by which I can pass values to my web.config file.
means as the stored procedure, can i pass the values for the ConnectionString that is declared in web.config?
means i want to pass the serve, database, uid & pwd to the web.config through any variable or parameter. I dont want to write these manully!!!!!!!
 
Old June 8th, 2006, 02:11 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

You can use string formatting, so in the appsettings, you define:
<add key="cs" value="server={0};initial catalog={1};integrated security=false;uid={2};pwd={3}" />

In your code, you get the appsetting cs and use String.Format to replace the placeholders {0}, {1}, etc with the appropriate values.

Brian





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
web.config rrkano .NET Framework 2.0 1 June 23rd, 2008 02:50 PM
Web Config C# akshay144 VS.NET 2002/2003 0 November 10th, 2006 10:21 AM
Web.Config tranzformerz ASP.NET 1.0 and 1.1 Basics 1 August 29th, 2005 05:59 PM





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