testing my project

  • Thread starter Thread starter rodchar
  • Start date Start date
R

rodchar

hey all,
can someone please tell me if this is possible and what the best way of
doing it is; on my aspx page i'd like to have 2 buttons and depending on
which one was clicked i'd like to go and modify the web config file for the
app and change the initial catalog appropriately.

is this possible and what would be the best way?

thanks,
rodchar
 
This is probably more of an ASP.NET group question than a C# language group
one.
You might be better off just storing two separate connectionStrings section
items. Then whichever button is clicked you could store the selected
connectionString in a Session item. The reason I say this is because if you
modify the web.config file while your ASP.NET app is being used, its going to
restart. That would blow away all your Session, Application and Cache items.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
 
You cannot alter a we.config file while the app is running, at least not
using the app itself. You can set it up as it is installed on the machine,
if that is your desire.

You would be better to set up the connection string at install time. Or, set
up two connection strings (ala Peter's idea) and use some form of factory
method to determine which one to use. You will probably end up editing the
web.config file anyway, unless you want to build your own non-locking config
file mechanism, which would not be my idea of a fun weekend.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

*************************************************
| Think outside the box!
|
*************************************************
 
Back
Top