Tuesday, February 4, 2014

What is OR operator in CSS selector?

Comma:

h1, h2, h3 { font-family: sans-serif }

In W3 calls grouping
http://www.w3.org/TR/CSS2/selector.html#grouping

Monday, February 3, 2014

How to get visitor IP address in static method?

        protected static string GetUserIPAddress()
        {
            string VisitorsIPAddr = string.Empty;
            if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
            {
                VisitorsIPAddr = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
            }
            else if (System.Web.HttpContext.Current.Request.UserHostAddress.Length != 0)
            {
                VisitorsIPAddr = System.Web.HttpContext.Current.Request.UserHostAddress;
            }
            return VisitorsIPAddr;
        }

Thursday, January 30, 2014

How to fix problem: In ASP.NET form authentication, cookie only working under compatibility mode in IE 10 or above?

In web.config file, Add cookieless="UseCookies" property into Form Authentication section
<authentication mode="Forms">
<forms cookieless="UseCookies" loginurl="/" name=".AUTH" path="/" timeout="10000">
</forms></authentication>
Reference:
http://stackoverflow.com/questions/6983732/ie10-user-agent-causes-asp-net-to-not-send-back-set-cookie-ie10-not-setting-coo

Wednesday, January 29, 2014

How to get index for foreach binding in Knockout?

                




The Syntax for get parent data index is:
$parentContext.$index