Tuesday, April 15, 2014

How to manually update ASP.NET MVC 3 project to ASP.NET MVC 4?

Tried  nugget first, failed. If a simple project, should try this first.
https://www.nuget.org/packages/UpgradeMvc3ToMvc4

Then follow instruction from Microsoft to upgrade manually:
http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253806

In addition to reference above:
1. Change web.config file in view folder  as well
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />

<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />

<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

2. Add reference to System.Web.Optimization
By run nuget package: Install-Package Microsoft.AspNet.Web.Optimization

How to create a Windows EventLog source by command line?

Open command line window with admin permission
eventcreate /ID 2 /L APPLICATION /T INFORMATION /SO YourEventSourceName /D "Application infor"

Thursday, April 10, 2014

Where to check IIS server version

Check file property:
C:\Windows\System32\inetsrv\InetMgr.exe

Tuesday, April 8, 2014

How to prevent cache in ASP.NET Single Page Application when use Javascript Ajax calls?

Turn off cache in Jquery Ajax call
        $.ajax({
            url: "url",
            cache: false,
            dataType: 'json',
            async: true,
            success: function (data) {
            },
            error: function (xhr, ajaxOptions, thrownError) {
            }
        });
    }