Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-18
2
Medium Priority
?
358 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 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

618 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