Click here to Skip to main content
16,018,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my project i have defined a variable 'string' that holds the connectionstring property of a particular server in the Application_start event of Global.asax file.
How should i change the value of this variable through coding.
So that when a user first login a dropdownlist will appear and based on the choice selected a respective string value will be assigned.
Posted
Updated 24-Mar-10 23:24pm
v2

1 solution

Based on your requirement, it does not look like a good design to store/assign connectionstring value in your Application_Start!

The Global.asax file is an optional file used to declare and handle application and session-level events and objects for an ASP.NET web site running on an IIS Web Server.
The Application_Start event is fired the first time when an application starts.

If you are defining a 'variable string' in your application start, you can go ahead and modify it but what's the use of it keeping in Application_Start at the first place?

From what you need is, you have to get the datasource from dropdown(as selected by user), construct the connection string then at runtime and use it for that session. Since it's user based, no point in keeping it at application level.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900