Solved

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

Posted on 2011-09-18
2
345 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

In this article I will describe the Detach & Attach 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.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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