VB 2008 App - Encrypt Database Connection String In App.Config
Sep 21, 2011
I know this topic has been addressed a million times but please help me out. I have read so many articles on HOW TO encrypt and decrypt the app.config file but I need to know WHEN and WHERE I should encrypt it.
The problem arose because we found an AppName.exe.config file on a users computer and the database username and password was clearly visible. I understand that the .config file gets created during the VB app install process and is used
by the application. I then learned about the aspnet_regiis.exe tool and ran it on the app.config file inside my VB project. I am guessing that was the wrong thing to do.
When I now install the app on user desktops, it gives an error stating failed to decrypt the connection string. Also, when one of my other developers attempts to open the project in his copy of visual studio on his computer, he receives an error when trying to access the setting portion of the project properties. We store all of our projects on a file server and any developer can access the projects via a mapped drive on their computer.
So how am I supposed to encrypt the .config file. If I can't encrypt the App.config file in the development environment, then I'm guessing I have to perform the encryption on the users PC during the install process? How do I do that? Or is that what I am supposed to do?
Just for reference, here is the aspnet_regiis command I ran.
One last thing, maybe it's my misunderstanding of the issue but if this problem has existed since .Net 2.0, why has an option not been built into the development studio to encrypt connection strings?. This would seem to be a very common issue, even their own dataset wizard creates connection strings that are clearly readable.
I have a question about the App.Config file. My understanding is that the connection string is stored within this file. I have setup my application so that the App.Config file is not only written to c:users<username>appdatalocal but also to c:users<username>appdataoaming. I plan to encrypt the connection string, my question at this point is will it encrypt the connection string in ALL copies of the App.Config file? It looks like at this point that the App.Config file is stored in two places on the hard drive.
I have been reading/researching/taking advice on connecting to my db by storing the connection string in my app.config. I have the connection string named "MyDB" in my app.config file. However, I cannot figure out how to use it in my code. I use mySQL. I added the configuration.dll reference. How do I pull the connection string from the app.config file and open a connection with it?
You will find attached the source code of a small program. I wanted to know if it was possible to modify the connection string in Web.config and use a connection to MySQL. I made some attempt, but does not connect.
Private Sub save() Dim con As New SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=D:Chuttu VBProjectsLICLIC.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")[code]......
For example i have form within the application which shows the connection string in a text box so the user can change it to there database but i cant work out how to save the new string to the connection string within the app.config file
I have classes that get the connection string the the .config file through ConfigurationManager. They work great in the actual application. When I use them in a unit test with nUnit I recieve an 'Object referance not set to an instance of an object'. I also tried to see if nUnit would read a ConfigurationManager.AppSetting and it failed too. Is there a configuration or workaround for this?
For the first time for my project i have saved the connection string in config file. i have created a new config file by the name of SQL.Config and used it in app.config <connectionStrings configSource="SQL.config"/>
I'm stuck regarding to grab connection from app.config file...i'm surf many type and kind to do it..but still can',t.....i need to connect into two database (oracle n firebird).
I have a connection string (which works fine) to connect to AD through my web application in my web.config. Traditionally, however, I've created a new connection to pull info. from the user after login like so:
Using adDirectory as New DirectoryEntry("LDAP://OU=myou,DC=mydc,DC=dc,DC=com") Dim adTicketID as String = ticket.Name myVar = "adDirectory.Children.Find("CN=" & adTicketID).Properties("myproperty").Value End Using
It seems that I should instead use the connection from the web.config like so:
Using ADCS as New DirectoryEntry Dim adTicketID as String = ticket.Name myVar = "adDirectory.Children.Find("CN=" & adTicketID).Properties("myproperty").Value End Using
Is this possible? How would I accomplish it so that I don't need to constantly create new directoryentries?
I been working on a Printer INK Management Program for my Company. We have many different districts we deal with. Each district has a different Server.I am trying to create the application where they can place the database file anywhere they would like on the server and when they first run the application it would ask them to choose the location of where they placed the file.I would like to know how i would be able to edit the connection string information in the app.config file during run time.
I want to write the connection string of my application in app.config file. I dont know how to write it or how to dynamically change it from my application source code either. My App.config file shows like..
I need to know what is the common way to store a SQL server connection string for an application in VB.NET.How do I read app.config values How to do it in ASP How do I store a connectionstring (unencrypted thus unsafe)It's quite frustrating not to find a decent and full answer on how to store a connection string in VB.NET in app.config (or settings.settings if it's better) safely. At the moment it's hardcoded and so it is immobile and in plain text.
I have tested my code in a windows form project and it works great. so now I want it to run as a service.The problem i have is referring to "name" in my configuration string which is in app.config.
Dim settings As ConnectionStringSettings = _ ConfigurationManager.ConnectionStrings(Name)
(Name) is under-squiggled and message name is not declared, file IO functionality is available in the microsoft.visualbasic namespace.
I've been getting this error when I try and use my model container:
No connection string named 'PFModelContainer' could be found in the application config file.
I have my edmx file in a separate project. I checked the app.config file and my model was there, and I also put it in my main project app.config file. Still doesn't work. Here's the connection string:
getting connected using an app.config instead of hardcoding since yesterday evening and I either can't find any more info on the net that helps or I'm too new to understand it all. The exception is occurring on the line assigning the connectionstring to 'returnvalue'.
Imports System.Configuration Imports System.Data.SqlClient Public Class Form1
I want to ask that where to store connection string in VB.Net.AS in ASP.net we can store connection string in web.config file and access it in the foll. way [code]In VB.net where to store conn. string on form_Load or any other place???
I'm creating window application with VB.NET and flatfiles.the problem is how do i store the connection string in the app.config file that include the application.startup path?
I am storing my connection string in my app.config file. I am using sql server express 2005. The connection string on my dev machine is different from the ones at the clients. so each time I update I open the config file and edit the connection string setting. This is quite a pain.also I have now published my app to an ftp folder so that the clients can get the updates each time I make changes. saves me the hassle of going to them each time i update. so now i need it to be so that I won't have to change the setting all the time.Would the best way be to store the connection string in a settings table in the database?
I have attached Database to my vb.net application. Client has sql server 2008 express installed.I built my application and gave to him. he is encountering errors.
i am getting Cannot Open Database for requested Login. Login Failed. i am using SQL 2008 server Developer edition. And using Windows Authentication mode.