Thứ Hai, 28 tháng 11, 2016

Route Constraints
alphaMatches uppercase or lowercase Latin alphabet characters (a-z, A-Z){x:alpha}
boolMatches a Boolean value.{x:bool}
datetimeMatches a DateTime value.{x:datetime}
decimalMatches a decimal value.{x:decimal}
doubleMatches a 64-bit floating-point value.{x:double}
floatMatches a 32-bit floating-point value.{x:float}
guidMatches a GUID value.{x:guid}
intMatches a 32-bit integer value.{x:int}
lengthMatches a string with the specified length or within a specified range of lengths.{x:length(6)}
longMatches a 64-bit integer value.{x:long}
maxMatches an integer with a maximum value.{x:max(10)}
maxlengthMatches a string with a maximum length.{x:maxlength(10)}
minMatches an integer with a minimum value.{x:min(10)}
minlengthMatches a string with a minimum length.{x:minlength(10)}
rangeMatches an integer within a range of values.{x:range(10,50)}
regexMatches a regular expression.{x:regex(^\d{3}-\d{3}-\d{4}$)}

Thứ Bảy, 19 tháng 11, 2016

Enabling Windows Authentication in Katana

using System.Net;

namespace Owin
    public static class WindowsAuthenticationExtensions
        public static IAppBuilder UseWindowsAuthentication(this IAppBuilder app)
            object value;
            if (app.Properties.TryGetValue("System.Net.HttpListener", out value))
                var listener = value as HttpListener;
                if (listener != null)
                    listener.AuthenticationSchemes =

            return app;

Thứ Tư, 16 tháng 11, 2016

Regex pattern for comma separated list

<textarea ng-pattern="/^([^,]+)(,[^,]+)*$/i"></textarea>

Allow one comma at the end:

<textarea ng-pattern="/^([^,]+)(,[^,]+)*(,?)$/i"></textarea>