473,396 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Common connection string file

Hi, On ASP 3.0 I was able to create a file conn.vbs where the connection
string lines to the db resides in, how can i do the same on ASP.Net?

The reason of this is to avoid modify the line in only one file instead of
do it in several web pages.
Oct 5 '08 #1
5 3069
egsdar wrote:
Hi, On ASP 3.0 I was able to create a file conn.vbs where the
connection string lines to the db resides in, how can i do the same
on ASP.Net?

The reason of this is to avoid modify the line in only one file
instead of do it in several web pages.
You would do it in your web.config file, using the appsettings section.

There was no way for you to know it (except maybe by browsing through some
of the previous questions in this newsgroup before posting yours - always a
recommended practice) , but this is a classic (COM-based) asp newsgroup.
ASP.Net bears very little resemblance to classic ASP so, while you may be
lucky enough to find a dotnet-knowledgeable person here who can answer your
question, you can eliminate the luck factor by posting your question to a
group where those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.aspnet or the forums at www.asp.net.

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Oct 5 '08 #2
Bob is correct - .NET, use web.config, for ASP you could use the global.asa
file (to set an application session variable) though I'm not a big fan of
that myself. Our classic ASP DB calls go through a specific COM that handles
DB traffic - not all too pleased with that either, but I'm happier with that
than the global.asa route.

"egsdar" wrote:
Hi, On ASP 3.0 I was able to create a file conn.vbs where the connection
string lines to the db resides in, how can i do the same on ASP.Net?

The reason of this is to avoid modify the line in only one file instead of
do it in several web pages.
Oct 6 '08 #3
B@DJJ wrote:
Bob is correct - .NET, use web.config, for ASP you could use the
global.asa file (to set an application session variable) though I'm
not a big fan of that myself. Our classic ASP DB calls go through a
specific COM that handles DB traffic - not all too pleased with that
either, but I'm happier with that than the global.asa route.
Could you clarify why you aren't a fan of using global.asa (or session
variable, if that was what you were referring to)?

Thanks

Oct 7 '08 #4
Sorry - just saw the post:

I'm more of a Mother Hen, really - Unless you really lock down the
global.asa so it can't be read by miscreants it's possible for someone to
access the global.asa and view it's contents (not directly via IIS (if
properly hardened) usually, but that's not where my concern is - I've had
consultants who thought it was a "good idea" to have a page that would
display the contents of any file via the browser simply by giving the page
the filename (Bad Programmer, Bad!)..... also, depending on what type of
security you want to implement at the DB-end, if the connection info is in
the global.asa anyone doing programming would have access to the userid/pswd
to your production db and it's never the ones that behave that you have to be
concerned about - same issue could arise with the web.config file in .net -
what I usually prefer is that either a COM or an Assembly (classic ASP or
..NET) be used to access the DB, properly locked down with very limited access
to the source code.

HTH

"Neil Gould" wrote:
B@DJJ wrote:
Bob is correct - .NET, use web.config, for ASP you could use the
global.asa file (to set an application session variable) though I'm
not a big fan of that myself. Our classic ASP DB calls go through a
specific COM that handles DB traffic - not all too pleased with that
either, but I'm happier with that than the global.asa route.
Could you clarify why you aren't a fan of using global.asa (or session
variable, if that was what you were referring to)?

Thanks

Oct 17 '08 #5
Hi,

Thanks for getting back on this...

B@DJJ wrote:
Sorry - just saw the post:

I'm more of a Mother Hen, really - Unless you really lock down the
global.asa so it can't be read by miscreants it's possible for
someone to access the global.asa and view it's contents (not directly
via IIS (if properly hardened) usually,
Are the miscreants that you refer to those with access to the server? It was
my understanding that those simply with access to a site can not read ASP
code in any of the files, but if there is a vulnerability, I'd like to be
aware of it. It would seem that, should such vulnerability exist, there
would be no way to "really lock down" the global.asa (or any other ASP
file). An example or reference would be appreciated.
but that's not where my
concern is - I've had consultants who thought it was a "good idea" to
have a page that would display the contents of any file via the
browser simply by giving the page the filename (Bad Programmer,
Bad!).....
Hmm, well, I've long wrestled with what delineates a page and have asked
here before (with somewhat differing responses). It was again my
understanding that a redirection to "foo.asp" would not make its server side
code visible. Being somewhat a novice with ASP, it would seem that exposing
the server-side contents would require quite a bit of deliberate
programming. For example, a page that reads "foo.asp", and parses the code
into browser-compatible responses. Perhaps I am missing your point,
though...
also, depending on what type of security you want to
implement at the DB-end, if the connection info is in the global.asa
anyone doing programming would have access to the userid/pswd to your
production db and it's never the ones that behave that you have to be
concerned about - same issue could arise with the web.config file in
.net - what I usually prefer is that either a COM or an Assembly
(classic ASP or .NET) be used to access the DB, properly locked down
with very limited access to the source code.
This makes sense, as it may narrow down the list of possible miscreants. Of
course, those doing programming could probably hijack the production
database anyway, no? ;-)

Neil
Oct 18 '08 #6

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

Similar topics

6
by: Paul Robinson | last post by:
I am developing a website in ASP that connects to a Sybase database. However, when I try to open a connection to the database the page will not load. The script does not timeout, nor the...
17
by: AMC | last post by:
Hi, I'm using an include file to store the connection string to a database. Whenever I try to reference that string to open a connection in the page that includes the file I get the error 'empy...
5
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data....
2
by: Alex Smith | last post by:
Hi Friends I want to make common connection string for database. I can not use Web config file, so please give idea excluding web.config file. Thanks. Alex
6
by: Jon Davis | last post by:
I like the drag-and-drop accessibility of dragging a table to a Web Forms designer and seeing a SqlDataAdapter automatically created for me.. being able to create a DataSet from that is fun and...
6
by: Bala Nagarajan | last post by:
Hello, I am using Oracle 9i in my application and facing a problem with the connection string. In the datasource attribute of the connection string i had to specify an entry in "tnsnames.ora"...
14
by: WebMatrix | last post by:
Hello, I have developed a web application that connects to 2 different database servers. The connection strings with db username + password are stored in web.config file. After a code review,...
1
by: Manish | last post by:
Hi i have a problem where as i want to use two different C# net program in a single system where i have used 2 different sql server name. when i execute those program each time iam renaming the...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...

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.