ASP.NET User/Role Management in VS2010 - skipping over the SQL Express version and going straight to SQL Server 2008 R2 - asp.net

As I'm learning the ins and outs of ASP.NET user management, I've learned that the default in VS is for it to use a SQL Server Express .mdf file for the data it needs to save. This won't help me for when I deploy my site, as I'm running SQL Server 2008 R2 on my IIS 7.5 server. I know that I can run a command line tool to automatically create the db tables necessary for user management, and will do that on my development machine, but how do I tell my existing, in development code in VS to ignore the existing Express .mdf file and look at the newly created db tables?

Simply update your Web.Config to set up the role provider and the database connection string:
http://weblogs.asp.net/scottgu/archive/2006/11/20/common-gotcha-don-t-forget-to-clear-when-adding-providers.aspx
http://www.codersbarn.com/post/2008/02/24/ASPNET-20-Guest-Book-Admin-Part-II.aspx
Also, Scott Mitchell's Membership and Roles tutorial series is the most comprehensive I've seen:
http://weblogs.asp.net/scottgu/archive/2006/05/07/ASP.NET-2.0-Membership-and-Roles-Tutorial-Series.aspx

Related

SQL Server Express and SQL Server Compact Edition

I've just built my first Umbraco site and now I want to hand it over for deployment on a web server. However, I built the site on my local machine using Web Matrix, which uses a SQL Server Compact Edition database, which is represented in a .sdf file.
I was a bit uneasy about whether this would be much use to the person I'm passing the site to (they have a number of Umbraco based sites running on this server using SQL Server) - so I installed SQL Server Express and migrated the database from Compact Edition to Express. However (again), I can't seem to find any way of exporting the full database to a file which can then by imported into a database on the web server.
A couple of points I guess - first, is the Compact Edition .sdf file actually enough for someone to take and import a database into SQL Server Standard? Failing that, how would I export the database from SQL Server Express to a file which could be used for this purpose?
Thanks in advance - this is my first foray into .net development so I'm grateful for any help!
You could just give the SQL CE database (.sdf) to the person who manages the web server. The SQL CE database can be run by default on a .NET webserver.
If, for some reason, you want to migrate it to SQL Server, you can do this through Web Matrix (http://www.microsoft.com/web/)
When you have already converted the SQL CE database to SQL Server, you can:
make a backup through the SQL Server Management Studio tool and restore the backup on the web server
or you can use the SQL Server Management Studio tool to script the database to a .sql file which can be executed on the web server
I prefer the first option.

How to configure ASP.NET membership after removing SQL Express 2008 and installing SQL 2008 R2 Enterprise

As the title says, I used to have SQL Express 2008 on my machine. After creating a new Web application, Visual Studio would automatically create the aspnetdb.mdf database and add a connection string to the Web.config file.
Since installing the full version I've found, to my surprise, that it's not possible to reference a local .mdf database any more. Firstly, is that true?
With that in mind, I used aspnet_regsql.exe to create an aspnetdb.dbo database on my local server. I then used the 'Server Explorer', in VisualStudio, to attach that database to the 'Data Connections'.
The problem is, every time I create a new web application, it sticks a local SQLExpress connection string into the project template.
Is there something else I have to do to rectify this?
Thanks

Visual Web Developer Express, how to run SQL to a new database

How do I run a DDL-SQL to create tables on a newly created database in Visual Web Developer 2010?
New to the ASP.NET world, I'm trying to insert the ddl to build the Northwind database.
I've tried the trick of inserting the SQL from a query-view, but SQL Server Express Edition crashes :-)
(Hello Microsoft, long time, no see...)
You can download MS SQL Server Management Studio Express (it's free). With this tool managing SQL Server databases is a lot easier.
Edit (answer to the comment below),
It doesn't work that way :) SQL Server has two authentication methods: Windows authentication and its own (user and password). First you need to use Windows authentication to log in and you can do whatever you want, for example change the sa (server administrator) password.

Deploy SQL Express in App_Data directory

Despite using many sql databases before, I've never actually tried to develop an app with a database in the App_Data directory.
Until now!!
It's a small WCF service project, which has a sql express 2008 r2 database.
Working in VS there are no problems, I thought it would be as easy as deploying to a server (win 2008 with sql 2008 r2 installed) and it would just work. But it would appear not.
In the web.config, the connection string which uses |Data Directory| in the connection string.
I read here that |Data Directory| only works in VS, but looking at other articles on the web that doesn't seem to be the case.
I have (for the sake of this) given everyone modify rights on the app_data dir on the server.
I deployed using the package feature in VS 2010.
Thx
S
This problem was related to the application pool account in IIS not having permissions on the SQL Express instance.

SQL Server 2008 user instance database creation failure within an asp.net project

I'm trying to create a database within the app_data folder of an asp.net mvc project using the IDE, but i am getting a "Required Components Missing" message indicating "Connections to SQL Server files (*.mdf) requireSQL Express 2005 ....."
I am using
- Windows 7 Enterprise
- VS2008 Team System SP1
- SQL Server 2008 Developer Edition SP1
I have altered the database connection to use the default instance by setting to blank using
Tools -> Options -> Database Tools -> Data Connection : SQL Server Instance Name
I also note from the SQL Server Books Online that the user instance feature will be removed in the future, but for now it suits my effort in developing an application where a number of people are working on the project.
Has anyone managed to create a database in the same manner?
It appears Nerd Dinner has done so
The attached user-instance database in the App_Data will work only with a SQL Server Express edition - 2005 or 2008.
It does not work with a full SQL Server edition, like Web, Workgroup, Standard, Enterprise or Developer. It does not - no way - no trick to make it work - does not - period.
If you want to use that mechanism of attaching a user instance database in your App_Data folder, you must use SQL Server 2005/2008 Express.

Resources