Wednesday, November 27, 2013

How to solve "This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false". "

When deploy a website on IIS Server first time, get following 500 internal server error:
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

The first thing to do is to run
turn on/off Windows features:

So can check if related features are enabled on the server




Tuesday, November 26, 2013

How to enable html source button on tinyMCE?

Add "code" into plugins list, then add "code" into button array
        tinyMCE.init({
            // General options
            mode: "textareas",
            plugins: "spellchecker,code",
            theme : "advanced",
            theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink,code",
            theme_advanced_buttons2 : "code",
        });

Weinre with Browserstack

http://arafat.azurewebsites.net/2013/11/16/weinre-on-azure-in-combination-with-browserstack/

Wednesday, November 20, 2013

How to implement minimum string length validation by Data annotation in ASP.NET MVC?

Two ways:
Fisrt:
        [StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 10)]
 
Second:
Regular expression
[RegularExpression(@"^.{10,}$", ErrorMessage = "Minimum 10 characters required")]