Solved

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

Posted on 2011-09-18
2
309 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

25 Experts available now in Live!

Get 1:1 Help Now