Asynchronous Child Actions Still not Supported in .NET 4.5.1

We have updated our project to .NET 4.5.1, but we see asynchronous child actions still not supported: When we tried to use ChildAction, we got the following error message:

Server Error in ‘/’ Application.

HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Continue reading “Asynchronous Child Actions Still not Supported in .NET 4.5.1”

ASP.NET MVC View Html.DisplayFor Renders Very Slow ?

We had a 2000 rows data model to display on ASP.NET MVC view page, but when we tried running we found that the web page seems always crashed: no more response.

First we thought it was server side, we spent long time to debug but finally we found the total 2000 rows have already transferred to client, so the problem must be caused by client web page, then we checked the view, we used Html.DisplayFor to render the data list item, then we knew the issue must caused by the Html.DisplayFor rendering.

Continue reading “ASP.NET MVC View Html.DisplayFor Renders Very Slow ?”

ASP.NET Web API Routing and Actions Notes

(Note: Here we only provide a learning note, so most sample code below are not ours, for example, most of them were copied from Microsoft ASP.NET website)

1: Similar to MVC routing, ASP.NET Web API uses routing too.

MVC 5 routing:

In the file App_Start/RouteConfig.cs:

public static void RegisterRoutes(RouteCollection routes)

        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

ASP.NET Web API routing:

In WebAPIConfig.cs file:

    name: "API Default",
    routeTemplate: "api/{controller}/{id}",
    defaults: new { id = RouteParameter.Optional }

Continue reading “ASP.NET Web API Routing and Actions Notes”

Host SignalR 2.0 in WPF Application

Microsoft has released new versions of ASP.NET, Visual Studio, SignalR etc. The real-time web might be focused on their SignalR tech since SignalR supports Web Sockets and other compatible techs.

Our team will have a new web project which needs us host SignalR in a WPF application. We searched online long time but most of SignalR Self-hosting samples only indicated how to host SignalR in a Console application.

Continue reading “Host SignalR 2.0 in WPF Application”

ASP.NET MVC 4 Validation Notes

Server Validation and Client side Validation:

We should know in ASP.NET MVC 4 (or 5 also), the web config items ClientValidationEnabled and UnobtrusiveJavaScriptEnabled are set to false by default, so unless we specified, all validations in ASP.MVC 4 are occurring on Server side.

If need Client Validation, we should either add the following into web.config:

     <add key="ClientValidationEnabled" value="true" />
     <add key="UnobtrusiveJavaScriptEnabled" value="true" />

Continue reading “ASP.NET MVC 4 Validation Notes”