The input[type="date"] in Internet Explorer (IE) 9 and 10

30. January 2013 09:26 by Mrojas in HTML5, IE  //  Tags: , , , , , , , , , , ,   //   Comments (0)

Well, yes yes. IE is becoming better and has more support for HTML5 features but... still a lot of things do not work.

And that is very normal, browser will start adopting HTML5 little by little.

In case you want to use HTML5 feature not supported by your browser (which usually will be IE) then use two things:

  • Feature Detection and
  • Polyfills.

Feature Detection is the ability to determine if an HTML5 feature is supported or not by our browser. A good library for that is Modernizr. What you can do with modernizr is detect if any feature that you need is not supported and if not then you can conditionally load some javascript libraries that will implement that feature. Those libraries are called Polyfills.

So for example if you want to use the <input type="date" /> tag in IE 10 you could use the controls to provide a date picker.

		nope: "js/jquery-ui.custom.js",
		callback: function() {
Figure 1: Modernize script to test is the date type is supported

 Modernizr tests is the feature is supported, optionally you can use the nope to indicate if there is a library that you wan t to load ONLY if the feature is not supported, and callback is code that will be called after the test and after loading the library.


And this is the screenshot:


Figure2: Screenshot of IE10 with date picker
This technique can be used for a lot of other features. A good (but a little old article about that can be found HERE)
I have uploaded some test code if you want to test this quickly. (148.76 kb)

Mouse Events/ Touch Events/ Gesture Events!!! Is there a general solution for this problem. Well Pointer.js might help

6. November 2012 21:05 by Mrojas in General, HTML5  //  Tags: , ,   //   Comments (0)
Now, we all write pages and HTML5 apps that must work in Mac/Linux/Windows/iPhone/iPad/S3/Nexus... you name it.
And sadly not all browsers behave the same, so a common problem is that you have to bind your code to all sort of events.
My friend Luis Diego send me a nice javascript library that tries to use the microsoft win8 idea of unified all these events under an umbrella of pointer events.
So if you are dealing with this issue I really recommend this post:
Pointer.js is the library proposed there. I tried it on my HTC WP7 and not everything works. On my pc works very nice and still need to tried on some mobile devices. 
I might need some tune up but is a great start.

Problem uploading large files in ASP.NET

12. October 2012 10:35 by Mrojas in ASP.NET, C#, Cloud, General, HTML5, SQL Server, VB6 Migration  //  Tags: , , , ,   //   Comments (0)

If you try to upload large files you might get an exception like

HttpException: Maximum request lenght exceeded.

This problem occurs because the default value for the maxRequestLength parameter in the section 

of the machine.config or Web.config file is 4096 (4M).

So any file with a size bigger will fail.

However I think that the max size that you can write here is 2G 2097151

Some info can be found here:;EN-US;295626


So to change that for 512mb use something like:




        <httpRuntime maxRequestLength="524288" /> 



IE Compatibility issues

21. September 2012 20:42 by Mrojas in General, HTML5  //  Tags: , ,   //   Comments (0)

It happen to me that I had a website working perfectly in my IIS and when I went to publish it it looked completely distortionated.

Why !! The eternal why.

I ended finding that it had something to do with the compatibility mode of IE, but why was it changing. It looks like it has some relation with the IIS version. Not sure why.

But the fix is to do something like:

    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
    <httpProtocol>       <customHeaders>         <add name="X-UA-Compatible" value="IE=edge" />       </customHeaders>     </httpProtocol>
This meta tag instructs the IE to set the compatibility mode to the highest value. 
You can use other values as IE7 or IE8So just put that and your site will look nice again :)



Binding problem when Sending JSON object to MVC3

25. May 2012 16:59 by Mrojas in ASP.NET, HTML5, JSON, Razor, Visual Studio  //  Tags: , , ,   //   Comments (0)

After a frustrating couple of hours trying to determine WHY WHY my object did not bind with MVC3 I finally found why.

The story began like this.

I have a very simple method in a controller. Something like this:


public class Form1Controller : Controller
        // GET: /Form1/

        public ActionResult Index()
            return View();

        public ActionResult DoButton1(Person zzz)
            return Json(data: "Good Test");

And I called that code with a jquery Statement like:
var person= JSON.stringify({ Name: "Mauricio", LastName: "Rojas" });              $.ajax({                                    
                    url: "/Form1/DoButton1/",
                    type: "POST",
                    dataType: "json",
                    data: person,
                    success: function () {
But!!! (maybe you already saw the obvious mistake) no matter what I sent, the Person object was not bind.
The action method got called but I was not able to see the sent values. I used Chrome developer tools and the network that show the
values I had modified.
I tried to debug the MVC code, but VS studio could not load the pdb, something I get that I still not sure why.
So how could I intercept what was happening? Simple with a ModelBinder.
A ModelBinder is class that is used to bind your request to a model object.
So I went to the Global.asax file and register my binder, and set some breakpoints.
//Code in Global.asax to register a Person Binder
    protected void Application_Start()
            ModelBinders.Binders.Add(typeof(Person), new PersonBinder());

    public class PersonBinder : IModelBinder
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
            var contentType = controllerContext.HttpContext.Request.ContentType;
            if (!contentType.StartsWith("application/json", StringComparison.OrdinalIgnoreCase))
                return (null);

            string bodyText;

            using (var stream = controllerContext.HttpContext.Request.InputStream)
                stream.Seek(0, SeekOrigin.Begin);
                using (var reader = new StreamReader(stream))
                    bodyText = reader.ReadToEnd();

            if (string.IsNullOrEmpty(bodyText)) return (null);

            var xx = new JavaScriptSerializer().Deserialize<Person>(bodyText);

            return xx;
And voila!! the content type I was getting was something like:application/x-www-form-urlencoded
So I just added the content type parameter to my javascript code:
                    url: "/Form1/DoButton1/",
                    type: "POST",
                    dataType: "json",
                    data: viewModelStr,
                    success: function () {
                    contentType: 'application/json; charset=utf-8' 

Output unescaped string in Razor

24. May 2012 00:03 by Mrojas in ASP.NET, HTML5, Javascript, JSON, Razor  //  Tags: , , , , ,   //   Comments (0)

While doing some experiments with Razor, and trying to generate some simple JSON objects in my ASP.NET MVC views
I had to deal with problems because my json string got a lot of weird &quot; and other strange escape character.
That in general is very good but I needed my string just as is.

The current workaround that I have found for doing that is:
var objectInStr = @(new HtmlString(Json.Encode(Model or your object)));

VB6 Migration, HTML5 Forms and ASP.NET Web Forms

16. February 2012 11:02 by Mrojas in HTML5, VB6 Migration  //  Tags: , , , , , , ,   //   Comments (0)

VB6 Migration, HTML5 Forms and ASP.NET Web Forms

If you come from a VB6 background, and your application is still in VB6,
you are probably wondering that this might be a good time to move out of VB6.

But is also a complex time. Which is right path: WinForms, Silverlight, WPF, HTML5?

Choosing the right target platform can be very tricky and depends on many varaiables.
So let's assume in this post that you have already decided that you want to use Web Tecnologies
and why not HTML5 as well.

ASP.NET Web Forms is a good technologie and developing forms with it is also very easy,
but can you develop HTML5 applications with this?

Well Brandon Satrom has a nice column in MSDN Magazine about Web Forms with HTML5 Forms.
He says:

If you’re planning to do HTML5 Forms development with ASP.NET Web Forms, there’s good news:
Many HTML5-related updates to .NET and Visual Studio are being released out-of-band, so you
don’t have to wait for the next framework version to use these features today.

To get started with HTML5 Forms and ASP.NET Web Forms, you’ll need to grab a couple of updates.
 First, make sure you have Visual Studio 2010 SP1 (
In addition to adding support for new HTML5 input types and attributes, the service pack also
provides some updates that enable you to use the new HTML5 input types on the TextBox server control.
Without this update, you’d see compile-time errors when using the new types.

You’ll also want to grab the Microsoft .NET Framework 4 Reliability Update 1 (
This update is designed to fix a handful of problems related to using the new HTML5 input types
with ASP.NET Web Forms. Scott Hunter covers a few of those—UpdatePanel, Validation Controls
and Callbacks—in a blog post from early August that you can check out at


Mobilize.NET and company now helps in the HTML5 migration problem from VB6, Windows Forms and PowerBuilder.


Migration of Point of Sale (POS) Applications to Mobile/Tablet Devices

22. January 2012 23:54 by Mrojas in HTML5  //  Tags: , , , , , , , , , , , , ,   //   Comments (0)

A long time ago, I had the idea of writing a series of posts about the issues
related to the migration of Point Of Sale applications developed in VB6.

 A lot of companies developed this kind of software in VB6, and they faced a lot of
of similar issues specially when dealing with POS devices.


It's nice that the industry has made the effort of developing standards as the UPOS or
Unified POS ( and Microsoft also did a great work
by providing the COM and .NET implementations.


It was nice to move VB6 applications to POS for .NET, but times have change and so
has the UPOS grown to interesting proposals like WS-POS.


"The fundamental benefit of WS-POS is the ability to provision POS peripherals as
services that can be accessed by remote POS applications, including mobile POS
solutions. Retailers can then use the power of Service-Oriented Architecture (SOA)
to allow access to their existing peripherals anywhere in the store through these
services. WS-POS holds potential benefits for all members of the retail ecosystem." from 


So you can now think about leveraring your VB6 POS to Silverlight or HTML5 and
consume WS-POS services to provide for example tablet-based implementations.
Imagine your POS application running in Silverlight or WinFX on a Windows 8 Tablet
or in HTML5 in iPads or Androids. Does it sound appealing? Well that is exactly the
kind of experience that our migration solution brings to the table.




You can download a working implementation of WS-POS from the  Association for Retail
Technology Standards (ARTS) web site.
Go to
Download the UnifiedPOS 1.13 pdfs and reference implementation from the
WS-POS Addendum link ( There are Java and WCF implementations. It is also very easy to modify the WCF
implementation so it can receive and respond JSON and work with your HTML5 implementations.

I always appreciate feedback, so if you have any more toughts or questions about HTML5 or Windows 8 POS implementations just let me know.