Tuesday, April 22, 2014

What is sparse array?

http://en.wikipedia.org/wiki/Sparse_array
a sparse array is an array in which most of the elements have the same value (known as the default value—usually 0 or null).

How to render an action without layout in ASP.NET MVC?

    public class HomeController : Controller
    {
        public string Create()
        {
     return "Hello";
 }
    } 
There are a couple of other ways:
http://stackoverflow.com/questions/5318385/mvc-3-how-to-render-a-view-without-its-layout-page
Change Layout default setting etc.
But return a string or json result, it is great way in some scenarios.

Thursday, April 17, 2014

Wednesday, April 16, 2014

How to solve problem: Proxy class not generated by wsdl command line or add service reference?

Use svcutil command line
svcutil  yourwsdlfile.wsdl
http://msdn.microsoft.com/en-us/library/aa347733.aspx
ServiceModel Metadata Utility Tool is a newer version than wsdl

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