I am about to deploy my first ASP.NET project.
But, I was used to store my variables, such as connection strings, in the
global.asa file, in an application. However, these variables are different
on my development and production server. If I use the global.asax file, then
it is in the code behing, compiled part. Thus I can't change the setting on
my production server.
So where is the right place to save my connecting string?
Leo 4 2413
The Web.config file might be a good place. In the system.configuration
namespace, you can find the appropriate methods to access this file in you
application.
Regards,
Kristof
"Leo Muller" <le***@keshet-i.com> wrote in message
news:c0**********@news2.netvision.net.il... I am about to deploy my first ASP.NET project. But, I was used to store my variables, such as connection strings, in the global.asa file, in an application. However, these variables are different on my development and production server. If I use the global.asax file,
then it is in the code behing, compiled part. Thus I can't change the setting
on my production server.
So where is the right place to save my connecting string?
Leo
That's what I have done - here's part of my Web.config file:
<configuration>
<appSettings>
<add key="MyConnectionString" value="...the connection string goes
here..." />
</appSettings>
I then retrieve it using
ConfigurationSettings.AppSettings["MyConnectionString"]
I also set the BuildAction property of the Web.config file to None, to stop
it overwriting the version on the live server.
Hope that helps!
"Kristof Van Praet" <kr**************@hotmail.com> wrote in message
news:ej**************@TK2MSFTNGP11.phx.gbl... The Web.config file might be a good place. In the system.configuration namespace, you can find the appropriate methods to access this file in you application.
Regards, Kristof
"Leo Muller" <le***@keshet-i.com> wrote in message news:c0**********@news2.netvision.net.il... I am about to deploy my first ASP.NET project. But, I was used to store my variables, such as connection strings, in
the global.asa file, in an application. However, these variables are
different on my development and production server. If I use the global.asax file, then it is in the code behing, compiled part. Thus I can't change the setting on my production server.
So where is the right place to save my connecting string?
Leo
Hi,
This helped me out, it works fine.
thanks,
Leo
"Sheila Jones" <sh**********@btopenworld.com> wrote in message
news:e1**************@TK2MSFTNGP12.phx.gbl... That's what I have done - here's part of my Web.config file: <configuration> <appSettings> <add key="MyConnectionString" value="...the connection string goes here..." /> </appSettings>
I then retrieve it using ConfigurationSettings.AppSettings["MyConnectionString"]
I also set the BuildAction property of the Web.config file to None, to
stop it overwriting the version on the live server.
Hope that helps!
"Kristof Van Praet" <kr**************@hotmail.com> wrote in message news:ej**************@TK2MSFTNGP11.phx.gbl... The Web.config file might be a good place. In the system.configuration namespace, you can find the appropriate methods to access this file in
you application.
Regards, Kristof
"Leo Muller" <le***@keshet-i.com> wrote in message news:c0**********@news2.netvision.net.il... I am about to deploy my first ASP.NET project. But, I was used to store my variables, such as connection strings, in the global.asa file, in an application. However, these variables are different on my development and production server. If I use the global.asax
file, then it is in the code behing, compiled part. Thus I can't change the
setting on my production server.
So where is the right place to save my connecting string?
Leo
Leo, use the web.config as follows:
<configuration>
<!-- application specific settings -->
<appSettings>
<add key="connectionString" value="user id=your
username;password=userpassword;initial catalog=nameofdatabase;data
source=servername;Connect Timeout=30" />
</appSettings>
<system.web>
"Leo Muller" <le***@keshet-i.com> wrote in message news:<c0**********@news2.netvision.net.il>... I am about to deploy my first ASP.NET project. But, I was used to store my variables, such as connection strings, in the global.asa file, in an application. However, these variables are different on my development and production server. If I use the global.asax file, then it is in the code behing, compiled part. Thus I can't change the setting on my production server.
So where is the right place to save my connecting string?
Leo This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jacob nikom |
last post by:
Hi,
I would like to store XML files in MySQL. What is the best solution:
1. Convert it to string and store it as CLOB/text
2. Serialize it and store as byte array
3. Flatten it out and create...
|
by: Charlie |
last post by:
Hi:
My ASP.NET app opens and closes database connection in several pages.
Rather than hard coding string into every page, is there a place I can put
it where all pages will be able to access it....
|
by: G. Dean Blake |
last post by:
We currently distribute a web application to serveral servers for a
customer. We have been putting the connection string in our web.config file
under <appSettings> <add...
|
by: Fernando Lopes |
last post by:
Hi there.
In your opinion, where is the best place to put the connection string of a
web application?
Web.config, a constant into the code?
I'm not using a component server, so it's not an...
|
by: |
last post by:
I have an app that retrieves data from an Access database. At the moment I
have the SQL string as a Const in my app. I understand this is not best
practice. I don't want the user to have access to...
| |
by: Benoit Martin |
last post by:
I'm developping a windows app that will be sold to different clients. The
app connects to a Database located on my server. That app is installed on
multiple machines for each client.
Each client...
|
by: Robin Tucker |
last post by:
I'm a bit confused about where to put my program settings.
Firstly, I can choose (I suppose) between .ini, .xml or the registry. Which
one is best?
Secondly, *where* do I place any files I...
|
by: Perre Van Wilrijk |
last post by:
Hi there,
When I started using VB6, I used to write classes with properties and
functions as following ...
Private lngf1 As Long
Private strf2 As String
Public Property Get f1() As Long...
|
by: Nemisis |
last post by:
Guys,
I would like to write a error handler, or something, that will allow
me to write to a database when an error occurs on my site. I am
trying to implement this in the global.asax file a the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |