Monday, November 26, 2012

Automatically map XmlhttpRequest post data to MVC action partameters

After converting a html Form to a xmlHttpRequest post request, the MVC action method can no longer get the mapped parameter value sent from client. The post data string is the exact between the two cases.

It turns out it is caused by not setting the Content-Type header in xmlhttprequest  object, and it is reasonable that server action method will not try to map the parameter value from post data, as with post request, the post data may be binary, json or any other formats.

So in order to fix the issue, the only required change is setting the content type explicitly for the request:

req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

And the server action method just stars to work again.

Monday, November 5, 2012

Install iso file on Windows 7 with WinRAR

The Virtual CD application provided by Microsoft no longer supports Windows 7, so it cannot by used to install iso file. If you do not want to burn the iso file into a real DVD, or using third party application to mount  the iso file to a virtual driver, you can just unzipped the iso file using WinRAR, which is a well known safe application to install on Windows 7.
After it is unzipped, just start the setup file (setup.exe), it should work as if it is installed from a DVD. Certainly, this will not work if you need to boot the box from the iso file.

Sunday, November 4, 2012

MS SQL Server 2008 sa authentication failure

Just installed a sql server 2008 and try to login using sa account. The login failed and few issues have to be checked using Windows authentication account before making sa account work:

1. Login SQL server management studio with windows account, right click server property menu, select Security, and check "SQL Server and Windows Authentication mode" under Server authentication section.

2 Still in server management studio, select Security folder, select sa user and right click property, check status item, and be sure it is Granted and Enabled in settings page