0

I've had some problems connecting with my database in a web application. The database is a .mdf and sits in my App_Data Folder. I'm using IIS 7.5 to run and debug my website.

I got following error:

Troubleshoot Error: An attempt to attach an auto-named database for file database location failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

I came up with this solution:

http://www.dotnetfunda.com/articles/article905-troubleshoot-error-an-attempt-to-attach-an-autonamed-database-for-file-l-.aspx

BUT this involves leaving my computer's login and password wide open in the web.config. As you may understand, I'm not too happy about that... Is there a way to hide my password from the web.config or solve this problem otherwise? Thanks.

1 Answer 1

2

Assuming your storing it in connection strings - since ASP.NET 2.0, you can encrypt any section...

run from your site root..

G:\content\snippet-site>C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "connectionStrings"

This should do the trick.

A bit more info... http://weblogs.asp.net/scottgu/archive/2006/01/09/434893.aspx

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. This will probably fix it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.