testing my project

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
 
P

Peter Bromberg [C# MVP]

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
 
C

Cowboy \(Gregory A. Beamer\)

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!
|
*************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top