Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI,

In my asp.net application , at first time launching the application, if there is no database connections provided ,it will redirect to separate page asks for entering the database details, if they provide valid details, we have to create the new database and need to use that connection string through out the application.

Here what my scenario is, after creating the database i stored the connection string in web.config file programatically, but when i trying to reuse the connection string it showing the empty string.

and i come to know that web.config file only gives the values what we provide at compile time. To overcome this situation i go for XML files to store connection string which is not secured to store the secured and sensitive information. Because my application should have the capability to change the connection string from front end.

here my questions are :

1 ) Is there any way to store the connection string securely,and that to have to change dynamically if change from the application.

2) I can access my XML file though browser, and can view all connection details, how can i restrict to access the XML file from the URL.

and any other better solution is appreciated.

Thanks
Posted

1 solution

You can encrypt the data and store in XML file or something.

And to restrict the access to a specific page, you can add the configuration setting in your web.config. See - Restrict access to a specific URL, running on IIS7 / ASP.NET[^]
 
Share this answer
 
Comments
V G S Naidu A 11-Aug-14 1:24am    
thaks for the suggestion,Is Any alternative for dynmicconnectionString Instead of xml file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900