Adding Roles and Membership to an SQL Server Database

January 8 2011 08:57 / by: Bryan Didas / Filed in:ASP.NET

The following steps describe adding roles and membership to an SQL Server database that stores user information and allows for authentication within ASP.NET applications. This happens to be one the many little tasks that I seem to do once every 3-6 months that I need to stop and think; where is the setup wizard located? The information or instructions exist in many places on the net, do a Google search on the above title or follow the steps below. I have put this post together so that in the future I hopefully wont have to stop and think so long.

Step –1: Navigate to the folder shown below in Fig -1a, this is the path on a typical WinXP machine. Double click aspnet_regsql.exe to start the wizard.

Wizard_App 
Figure - 1a

For a Windows 7 system the path is slightly different, Figure – 1b. Also depending on the frame works installed you can find the aspnet_regsql.exe in the V4.0 framework folder.

Win7 RegSQL 
Figure – 1b

As you can see on the welcome screen of the setup wizard, you can also configure roles and membership from a command line. The are additional features that can be setup which need to be configured from the command prompt and will not be covered in the post.

Wizard 
Figure - 2

Step –2, Setup Option: Select either configure SQL server for application services, which is the default or the option to remove application services from an existing database. Figure –3


Wizard2 
Figure - 3

Step –3: This is the most complicated step in the series. You will need the server name and instance name. You can use either Widows authentication or SQL Server authentication. Once you enter and server information and the authentication credentials a list of available databases will be shown in the drop down list. Select the appropriate database and then select next. Figure - 4

Select Database 
Figure - 4

Step – 4: Confirmation of settings you entered in step 3.

Confirm 
Figure - 5

Step – 5: Finish. Well that is it, simple. Open up your database and you can see the changes

Completed 
Figure - 6

 

Figure 7 shows the tables that are added to the selected database.

Table_List 
Figure - 7

 

An upcoming post will walk through the methods used to configure your application to utilize your database Roles and Memberships.

Reference:

Revisions:


Target Framework, .Net Framework 4.0 to .Net Framework 3.5

November 1 2010 15:02 / by: Bryan Didas / Filed in:.NET Framework, ASP.NET

I recently upgraded from Visual Web Developer 2008 to Visual Web Developer 2010 and have run into an issue, I started seeing a configuration error. In two cases I had been working on web applications in Visual Web developer 2010.

Case 1 appeared after I had opened an existing application and when prompted, do I want to configure the site for use with ASP.NET 4.0, I must have said yes.

Case 2 came when I created a new application and my system is setup to use Framework ASP.NET 4.0

In both situations I got the following error <compilation debug="true" targetFramework="4.0" /> pointing to my web.config file. I like working in Visual Web Developer 2010, but my hosting server is not yet setup for .Net Framework 4.0, so I needed to find out how to down-grade from 4.0 to 3.5 framework.

Config Error

 

The following is what I did to change the target Framework from ASP.NET 4.0 to ASP.NET 3.5.

1) Ensure IIS and the ASP.NET properties are configured for Framework 2.0. Note: Framework 3.5 will not show up in the list of installed options due to the fact that framework 3.5 is an extension of 2.0 and not a stand alone release.

 ASP.NET Properties

 

2) Configure you web application to use target Framework 4.0 by right clicking your website in the solution explorer >> Property Pages >> Build >> Change "Target Framework" to .NET Framework 3.5.

 VWD Site Properties

Then select the desired framework from the list.

VWD Build Properties 

This will update your web.config file with the correct information.

 

References:

The following links were used to find the solution.

NET Framework Developer Center, Forum: http://social.msdn.microsoft.com/Forums/en/netfxsetup/thread/a1bcee62-55a2-4fd2-8a78-1a1fbd95ebf3

MSDN Blog by Vijayshinva
http://blogs.msdn.com/b/vijaysk/archive/2008/03/20/running-asp-net-3-5-on-iis.aspx


Ajax Controls, Error: ‘Sys.Extended.UI’ is null or not an object

September 7 2010 18:19 / by: Bryan Didas / Filed in:Ajax, ASP.NET

While working through an integration of BlogEngine.Net into an existing web application I ran into a small issue with the Ajax controls I had implemented within the existing site. After the BE was migrated into the web application I noticed that when I viewed the page with the Ajax controls that rendering wasn't correct and that I started to get an error warning within the browser.

WebPage Error

Digging deeper into the error and the rendering issue I found “Error: ‘Sys.Extended.UI’ is null or not an object”. Obviously it was some conflict with the controls from BE to the Ajax controls on the original site.

The solution turned out to be pretty easy, the controls used within BlogEngine.Net and the Ajax control toolkit used within my original web application were conflicting. The solution was to add the CombineScripts=”false” option.

ToolScriptManager

Thanks to the following posts:

http://forums.asp.net/p/1589496/4023634.aspx

http://www.bloodforge.com/post/AjaxControlToolkit-is-undefined-(javascript).aspx