Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / December 2006

Tip: Looking for answers? Try searching our database.

Storing Connection String

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Stivenson - 30 Dec 2006 21:44 GMT
I have Users table in my database which stores usernames, passwords and other
information about users. When starting the application the user logs in
providing username and password.

This is why I want the connection string (including database username and
password) to be stored somewhere in code and not in application settings.
Only the program should "know" database username and password.

The database is accessed using both table adapters and command objects.

Which is the best place to store the connection string? How to specify this
connection string in existing table adapters?
Scott M. - 30 Dec 2006 21:51 GMT
I would still store the connection string in web.config and just inject the
user name and password into that string at run time.  Remember, the string
is retrieved as just a string, so you can modify it in your code after
retrieving it.

There is no need for your code to have any information about the database
itself.

>I have Users table in my database which stores usernames, passwords and
>other
[quoted text clipped - 10 lines]
> this
> connection string in existing table adapters?
Miha Markic [MVP C#] - 30 Dec 2006 23:20 GMT
Hi John,

There are several solutions, such as:
- use integrated security
- separate data tier (so your app won't need connection string anymore)
- encrypt config file

What kind of application do you have?

Signature

Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

>I have Users table in my database which stores usernames, passwords and
>other
[quoted text clipped - 10 lines]
> this
> connection string in existing table adapters?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.