Connection string in VB.NET

V

VK

Dear All:

We are in the processing of building a new web site using VB.NET and
SQL2000

I had a question about WHERE to store the connection string for SQL dB -
in an include file or web.config file? What are the pros and cons if
any? We may be connecting to more than one database.

Many thanks.
 
G

Guest

VX,

I store mine in the web.config file (intranet only). Actually I store the
ServerName and DatabaseName in the web.config file. I then pass this
information to another component that builds the connection string
dynamically and then connects and returns the connection object. In limited
circumstances where the connection string might include a username and
password, I store the entire connection string in the web.config file and
pass that directly into the connection component.

Storing connection information in the web.config is really only as secure as
your web server so use accordingly.
 
R

Rakesh Rajan

Hi VK,

In addition to Mike's post:
I used to encrypt the connection string (which would have the username and
pwd) and store it in a seperate file, which we decrypt @ run-time. Addition
of new connection strings won't call for a big coding effort.

HTH,
Rakesh Rajan
 
V

VK

Hi Rakesh,

Looks like you stored the connection string in a file which you would
include on all .aspx pages - which was encrypted.

like Mike suggested he used the connection string from web.config file
for his "intranet" site. Our web site would be the internet.

Thanks.
Vani
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top