Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old October 5th, 2008, 03:05 PM
=?Utf-8?B?ZWdzZGFy?=
Guest
 
Posts: n/a
Default 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.
  #2  
Old October 5th, 2008, 03:25 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default Re: Common connection string file

egsdar wrote:
Quote:
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"


  #3  
Old October 6th, 2008, 02:15 PM
=?Utf-8?B?QkBESko=?=
Guest
 
Posts: n/a
Default RE: Common connection string file

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:
Quote:
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.
  #4  
Old October 7th, 2008, 09:15 PM
Neil Gould
Guest
 
Posts: n/a
Default Re: Common connection string file

B@DJJ wrote:
Quote:
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



  #5  
Old October 17th, 2008, 02:05 PM
=?Utf-8?B?QkBESko=?=
Guest
 
Posts: n/a
Default Re: Common connection string file

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:
Quote:
B@DJJ wrote:
Quote:
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
>
>
>
>
  #6  
Old October 18th, 2008, 01:25 PM
Neil Gould
Guest
 
Posts: n/a
Default Re: Common connection string file

Hi,

Thanks for getting back on this...

B@DJJ wrote:
Quote:
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.
Quote:
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...
Quote:
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


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles