473,625 Members | 3,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

connectionstrin g in global.asax or web.config?

Bob
Hi,

i was wondering whether i would use global.asax or web.config for the
connectionstrin g to the database. I put this in global.asax.

Sub Application_Sta rt
Application("Co nnect") = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\mydb. mdb;"
End Sub

In web.config, i added:
<appSettings>
<add key="newres" value"Provider= Microsoft.Jet.O LEDB.4.0;Data
Source=c:\mydb. mdb;"/>
</appSettings>
What's the best way (speed, resources ..) according to you?

Thanks
bob
Dec 20 '06 #1
6 4375
the best place is your *configuration* file; i.e web.config

YvesL
Bob wrote:
Hi,

i was wondering whether i would use global.asax or web.config for the
connectionstrin g to the database. I put this in global.asax.

Sub Application_Sta rt
Application("Co nnect") = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\mydb. mdb;"
End Sub

In web.config, i added:
<appSettings>
<add key="newres" value"Provider= Microsoft.Jet.O LEDB.4.0;Data
Source=c:\mydb. mdb;"/>
</appSettings>
What's the best way (speed, resources ..) according to you?

Thanks
bob

--
Regards,
YvesL
Dec 20 '06 #2
It's much easier to put in web.config. That way you don't need to
recompile each time the connection string changes. Just edit
web.config and away you go

The downside is that web.config is an xml file which is humanly
readable so any passwords will be visible anyone that can access your
web site's content files locally

IIS will not serve up the web.config file though -
http://mywebsite.com/web.config will result in an server error

Bear in mind that MS Access is not particulartly scalable as a database
if you're epecting many concurrent visitors
Bob wrote:
Hi,

i was wondering whether i would use global.asax or web.config for the
connectionstrin g to the database. I put this in global.asax.

Sub Application_Sta rt
Application("Co nnect") = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\mydb. mdb;"
End Sub

In web.config, i added:
<appSettings>
<add key="newres" value"Provider= Microsoft.Jet.O LEDB.4.0;Data
Source=c:\mydb. mdb;"/>
</appSettings>
What's the best way (speed, resources ..) according to you?

Thanks
bob
Dec 20 '06 #3
use web.config, thats what its for. If your worried about security then
ecnypt it......

http://weblogs.asp.net/scottgu/archi...09/434893.aspx

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Bob" <gtdbdwrote in message
news:OI******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi,

i was wondering whether i would use global.asax or web.config for the
connectionstrin g to the database. I put this in global.asax.

Sub Application_Sta rt
Application("Co nnect") = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\mydb. mdb;"
End Sub

In web.config, i added:
<appSettings>
<add key="newres" value"Provider= Microsoft.Jet.O LEDB.4.0;Data
Source=c:\mydb. mdb;"/>
</appSettings>
What's the best way (speed, resources ..) according to you?

Thanks
bob

Dec 20 '06 #4
Bob
Thanks all

"John Timney (MVP)" <x_****@timney. eclipse.co.uksc hreef in bericht
news:CL******** *************** *******@eclipse .net.uk...
use web.config, thats what its for. If your worried about security then
ecnypt it......

http://weblogs.asp.net/scottgu/archi...09/434893.aspx

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Bob" <gtdbdwrote in message
news:OI******** ********@TK2MSF TNGP03.phx.gbl. ..
>Hi,

i was wondering whether i would use global.asax or web.config for the
connectionstri ng to the database. I put this in global.asax.

Sub Application_Sta rt
Application("C onnect") = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\mydb .mdb;"
End Sub

In web.config, i added:
<appSettings >
<add key="newres" value"Provider= Microsoft.Jet.O LEDB.4.0;Data
Source=c:\mydb .mdb;"/>
</appSettings>
What's the best way (speed, resources ..) according to you?

Thanks
bob


Dec 20 '06 #5
"John Timney (MVP)" <x_****@timney. eclipse.co.ukwr ote in message
news:CL******** *************** *******@eclipse .net.uk...
use web.config, thats what its for.
Agreed.
If your worried about security then ecnypt it......
Bear in mind that this will (almost certainly) not be possible on a public
site hosted by a 3rd-party ISP, as the account they give you to upload your
files will (almost certainly) not have sufficient privileges to run
aspnet_regiis, even if you somehow manage to pop a command window...:-)
Dec 20 '06 #6
Good point - forgot that bit :)

I assume that everyone hosts their own stuff on old laptops adn defunct kit
like I do........

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:%2******** **********@TK2M SFTNGP03.phx.gb l...
"John Timney (MVP)" <x_****@timney. eclipse.co.ukwr ote in message
news:CL******** *************** *******@eclipse .net.uk...
>use web.config, thats what its for.

Agreed.
>If your worried about security then ecnypt it......

Bear in mind that this will (almost certainly) not be possible on a public
site hosted by a 3rd-party ISP, as the account they give you to upload
your files will (almost certainly) not have sufficient privileges to run
aspnet_regiis, even if you somehow manage to pop a command window...:-)

Dec 20 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1971
by: Mark | last post by:
I have two projects - they both need to use the same web.config file, the same global.asax file, and share a common "look and feel" via several user controls. Is there an easy way for two projects to share these resources in VS.NET so we don't have to worry about synchronization issues ASIDE from combining the two projects into one? Thanks in advance! Mark
6
3625
by: Andrea Williams | last post by:
Where is the best place to put global variables. In traditional ASP I used to put all of them into an include file and include it in every page. Will the Global.aspx.cs do that same thing? Thanks in Advance! Andrea
3
6119
by: hansiman | last post by:
I use Application_Start in global.asax to set some physical folder paths ie.: Application("pdf") = "c:\www\<site>\pdf\" global.asax uses code behind. When I move the project from the dev to the production server the global.asax code behind is compiled into the project.dll (i guess). This renders the physical paths unusable (naturally). Coming from
12
3809
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it (the oleDBConnection on global.asa.vb) at the other aspx pages ?
8
4858
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical differences in the way both the objects are handled by IIS. Are both objects stored in different memory spaces? I can access both the objects in my web page. I will be grateful if some one can help me understand the difference.
1
3289
by: Anonieko | last post by:
Global.asax? Use HttpModules Instead! In a previous post, I talked about HttpHandlers - an underused but incredibly useful feature of ASP.NET. Today I want to talk about HttpModules, which are probably more common than HttpHandlers, but could still stand to be advertised a bit more. HttpModules are incredibly easy to explain, so this will hopefully be a short-ish post. Simply put, HttpModules are portable versions of the global.asax....
4
1970
by: Jeff | last post by:
Hey ASP.NET 2.0 I'm preparing for a www.123assess.com test and in that intention I yesterday took a skill assessment test at microsoft.com. Today I'm reviewing some of the questions I had problems with: One of the questions was about where the connections string should be placed in a web farm configuration. In this scenario there were several web
1
1864
by: teo | last post by:
I put some variables in a web.config file I have a global.asax file that needs to use one of those variables How can global.asax read that value? If I have more than one web.config file, how can the global.asax detect the right web.config file ?
5
1397
by: Eric Layman | last post by:
Hi everyone, Currently Im using Global.asax.vb to capture any errors and to send them via email to me. But I didn't get any emails when I purposely crash the web application. May I know what I am missing here? I've copied (shamelessly) the script from here: http://easerve.com/developer/tutorials/asp-net-tutorials-global-error-handling.aspx
0
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8189
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8692
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4192
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1499
bsmnconsultancy
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.