# Thursday, 19 April 2012

I’m developing an ASP.Net MVC application with Knockout 2.0/2.1rc.  I’m using modernizr (2.5.3) and css3pie (1.0 beta 5) to get CSS3 and HTML5 support on as many browsers as I can.

On a particular view I am using imageless add/delete buttons. I’m using Knockout to dynamically add and remove items from two tables.

I had to use css3pie to help make the buttons work in IE 6-8 with this line for the add button:

/* no fix currently for radial gradient in IE6-8... using linear instead.*/
-pie-background: linear-gradient(-90deg, #1b9918,#1b9918 65%,transparent 65%, transparent); 

and for the delete:

-pie-background: linear-gradient(-90deg, #da7d83, #da7d83 50%, #ca444e 50%, #ca444e);

When I apply the binding in KO (.applybinding), the buttons disappeared in IE 8.  At first I thought something was wrong in modernizr but after some testing I realized it was only IE 8 that was failing.  That got me thinking about css3Pie. After some searching around on the internet I found this post. The final response gave me my answer:

I have the same problem with a native ko templates, if I use "foreach" without a container element. Also, I was trying to use PIE.js instead of PIE.htc - but without success. For templates like data-bind="template: { name: 'itemTmpl', foreach: items }" css3pie works fine. Try to refactor templates using a container element. May be it is workaround solution.

I was using an anonymous/inline template:


    
        
+

When I changed the code to use a named template:



...
    

IE6-8 began working again.

According to the forum post, this may be an issue with KO 2.0.  I didn’t try it on an older version of KO but I did with KO 2.1rc and had the same results.

Happy Coding! Smile

Posted 04.19.2012  #    Comments [0]  | 
# Thursday, 01 March 2012

This week I have been setting up a new development IIS 7.5 server.  I have three websites all bound to a separate port and I needed each to be setup with SSL.  This functionality is built into IIS 7+ but you can only set the name for the cert.  If you need to change other settings then you’ll need to use SelfSSL. 

SelfSSL comes with the IIS6 Resource Kit.  However, it has a problem.  It works on IIS7 BUT only for the last certificate that you create with it.  It’s a known bug and I couldn’t find a newer version of SelfSSL.

SelfSSL7 to the rescue

SelfSSL7 is the fix.  I found this after using a slew of variants in my search terms.  That’s the reason I’m posting this.  It seemed way too hard to find for me.

Using SelfSSL7

If you type selfssl7 at the command line with no options it will create a default certificate for you site. The command to set the number of days and site and port number is listed below.

selfssl7 /N cn=<computername> /V <length of days for certificate> /I /S "<Default Website>" /P <portnumber>

selfssl7 /n cn=mylocalboxname /V 365 /I /S "Dev" /P 4040 would set the validity of the certificate for one year to the Dev website and on port 4040.

Now you can create as many certs as you need on IIS7+ machines.  It can also handle multiple DNS names.

Happy Coding! Smile

iis7 | iis7.5 | SelfSSL | SelfSSL7 | SSL
Posted 03.01.2012  #    Comments [2]  | 
# Thursday, 01 December 2011

The Test Helpers are a great way to ease your testing needs with MVC.  If your using the Test Helpers to test your routing like so:

            "~/".ShouldMapTo<HomeController>(x => x.Index());

When you run your tests you’ll get the following error:

System.Security.VerificationException : Method MvcContrib.TestHelper.RouteTestingExtensions.ShouldMapTo: type argument 'Your Controller Name’ violates the constraint of type parameter 'TController'.

The fix is a binding direct.

Add an app.config to your test project and paste in the following:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Happy Coding! Smile

Posted 12.01.2011  #    Comments [7]  |