Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

testing my project

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rodchar - 13 Mar 2008 18:58 GMT
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
Peter Bromberg [C# MVP] - 13 Mar 2008 19:46 GMT
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

> hey all,
> can someone please tell me if this is possible and what the best way of
[quoted text clipped - 6 lines]
> thanks,
> rodchar
Cowboy (Gregory A. Beamer) - 13 Mar 2008 21:41 GMT
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.

Signature

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!

*************************************************
> hey all,
> can someone please tell me if this is possible and what the best way of
[quoted text clipped - 7 lines]
> thanks,
> rodchar
rodchar - 14 Mar 2008 04:01 GMT
thank you all for the great insight :)
rod.

> hey all,
> can someone please tell me if this is possible and what the best way of
[quoted text clipped - 6 lines]
> thanks,
> rodchar

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.