Friday, April 27, 2012

Enabling sa account in SQL Express 2008


Problem:  
How to enable 'sa' account in  SQL server Express edition.
Problem Description: 
By default Microsoft sets the SQL Express login mode as Windows Authentication and disables the default 'sa' account.  This is done for several security reasons and best practice.   But sometime we need to overwrite this for various reasons, one that I come across recently was when I try to install an open source CMS product which requires an Admin account and it did not provide me the option to change the account to windows authentication.
Solution:
If you have installed SQL Server express with Windows Authentication mode and want to change it, you need follow these steps.
  1. Login to SQL Express with your windows authentication account
  2. Right-click on your SQL Server Express root (see the image below) and select Properties

3. Go to Security tab and change the mode to SQL Server authentication mode and click 'OK'
4. Go to security/logins, open SA login properties

5. Uncheck "Enforce password policy" and "Enforce password expiration" check box 
6. Assign password to SA user
7. Open "Status" tab and enable login (this can be also done via SQL editor  by running the following command:  ALTER LOGIN [sa] ENABLE)

Now login to your SQL server with 'sa' account.... 
Happy SQL Programming!!!

Friday, April 6, 2012

MVC3 deployment check-list

Overview:

When deploying ASP.NET MVC3.0, there are many challenges to solve, especially when use external hosting and I come across similar issue and sharing my solution here.

Problem:

After hosting the application, the application may not run and page not found error(404.x / 403.x)

Solution:

The following check-list helps to avoid deployment issues with MVC 3.0


1.    Check your web.config for the following code under .webServer> section
2.    Make sure the App pool is set to ASP.Net 4.0 with Integrated Mode.
3.    In your Project References set Copy Local to True for the following assemblies
1.     System.Web.Abstractions
2.     System.Web.Helpers
3.     System.Web.Routing
4.     System.Web.Mvc
5.     System.Web.WebPages
4.    Add the following assemblies to your project, and then set Copy Local to True
1.     Microsoft.Web.Infrastructure
2.     System.Web.Razor
3.     System.Web.WebPages.Deployment
4.     System.Web.WebPages.Razor