Solved

Security feature in asp.net web site administration tool doesn't work.

Posted on 2011-09-18
2
315 Views
Last Modified: 2012-05-27
Problem: every time I click on the “Security” icon in the asp.net Website Administration Tool, I get an “Unable to connect to SQL Server database” error. This error popped up 3 days ago and I can’t get rid of it.  VWD keeps on asking me to test the “Aspnetsqlprovider”.

I’m running VWD 2010 Express and SQL 2008 R2 Express. The SQL 2008 R2 server appears to be running properly. I am using Windows authentication. I can use the SQL 2008 R2 server to connect to the system databases and attach to other databases. The name of the server on SSMS is “HostComputer\SQLExpress”.

The code in the c:\windows\microsoft.net\framework\v4.0.30319\config\machine.config is as follows:
<connectionStrings>
		<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
	</connectionStrings>

Open in new window


In VWD, the Database Connection option has been set to: “.\SQLEXPRESS”.

I’ve used cmd.exe to set c:\windows\microsoft.net\framework\v4.0.30319\aspnet_regsql.exe to “.\SQLEXPRESS”. Coincidentally, whenever I run the asp.net SQL Server Wizard, it always points to “HostComputer”. Is that normal?

0
Comment
Question by:WhyDidntItWork
2 Comments
 
LVL 14

Expert Comment

by:nishant joshi
ID: 36557097
0
 
LVL 3

Accepted Solution

by:
ExpertLogin_890 earned 500 total points
ID: 36559170
First thing is try to use the web.config file for storing connection string instead of storing in machin.config and use the following things to resolve the issue

referred this link
http://www.dreamincode.net/forums/topic/229819-unable-to-connect-to-sql-server-database/

Or

1) Create a database in SQL Server (2000 or 2005) and make sure that you give the ASPNET account permissions to this database.
2) Run the aspnet_regsql.exe file in your System%Root\Microsoft.NET\Framework\v2.0.xyz directory.  This will open an ASP.NET SQL Server Setup Wizard which will create the objects necessary for ASP.NET security.
3) Point to the database you just created.
4) In your web.config file, locate the <connectionStrings> element and add the following:

<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=localhost;initial catalog=<your database name>;integrated security=true" providerName="System.Data.SqlClient">

This overrides the default SQL Express and points to the new database you just created - be it in the same machine or a different machine.  You can also change the configuration in the machine.config file although this will affect every web application sitting on top of your machine.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now