December 2010 Entries

Upgrade from Asp.Net MVC 1 to MVC 2 - how-to and issues with JsonRequestBehavior

Goal Upgrade your MVC 1 app to MVC 2 Issues You may get errors about your Json data being returned via a GET request violating security principles - we also address this here. This post is not intended to delve into why the Json GET request is or may be an issue, just how to resolve it as part of upgrading from MVC1 to 2. Solution First remove all references from your projects to the MVC 1 dll and replace it with the MVC 2 dll. Now update your web.config file in your web app root folder by simply ......

jQuery 1.4.4 - issue with attr('selected', null)

Issue: The code below worked before under version jQuery 1.4.2 but when I upgraded to version 1.4.4 it no longer worked as expected - it did not unselect the list box item, only setting "selectd" worked: _handleClick: function(elem) { var self = this; var initElem = this.element; var checked = $(elem).attr('checked'); var myId = elem.attr('id').replace(ini... + '_chk_', ''); initElem.children('option[v... + myId + ']').attr('selected', function() { if (checked) { return 'selected'; ......

After restoring a SQL Server database from another server - get login fails

Issue: After you have restored a sql server database from another server, lets say from production to a Q/A environment, you get the "Login Fails" message for your service account. Reason: User logon information is stored in the syslogins table in the master database. By changing servers, or by altering this information by rebuilding or restoring an old version of the master database, the information may be different from when the user database dump was created. If logons do not exist for the users, ......

Maximum request length exceeded.

Issue: The file upload size on your machine or web app is too small. The default file upload size for IIS is 4096K. The file size the user is trying to add can be retrieved (using the ELMAH log here) by looking at the Content-Length header property: HTTP_CONNECTION:keep-alive HTTP_KEEP_ALIVE:115 HTTP_CONTENT_LENGTH:6414851 In this example it is just over 6Mb Solution: You can add/update the HttpRuntime property in the machine or web config files, depending on at what level you want to set the size. ......

Resetting/Restoring the Windows PATH

Problem: For some reason you lost your Windows PATH settings and want to restore the previous version: Solution: First of you may reset it to the original setting to: Windows XP: C:\Windows\system32;C:\Wind... program paths} Windows 7: C:\Windows\system32;C:\Wind... program paths} Alternatively you could look for some previous version of the path in the registry. In Windows 7 you would look for "Path" name under Computer\HKEY_LOCAL_MACHINE... ......