Sholo.Web.Security/Authentication/User/UserAuthentication.cs
/// <summary>
/// Encrypts a FormsAuthenticationTicket in an HttpCookie (using GetAuthCookie) 
/// and includes it in the current Request's Cookies collection and/or the 
/// Response's outbound Cookies collection.
/// </summary>
/// <param name="clientTicket">The FormsAuthenticationTicket to encode</param>
/// <param name="overwriteRequestCookie">Whether or not to replace the cookie in
/// the current Request's Cookies collection.  This will trick later executing 
/// code on the current HTTP request into processing the updated cookie</param>
/// <param name="writeResponseCookie">Whether or not to write the cookie to the 
/// browser via the Response's Cookies collection.</param>
Encrypts a FormsAuthenticationTicket in an HttpCookie (using GetAuthCookie)
and includes it in the current Request's Cookies collection and/or the
Response's outbound Cookies collection.
Encrypts a FormsAuthenticationTicket in an HttpCookie ( using GetAuthCookie ) and includes it in the current Request ' s Cookies collection and / or the Response ' s outbound Cookies collection .
public static void SetAuthCookie(FormsAuthenticationTicket clientTicket, bool overwriteRequestCookie, bool writeResponseCookie)
        {
            Initialize();
            HttpContext current = HttpContext.Current;
            if (overwriteRequestCookie)
            {
                current.Request.Cookies.Remove(FormsAuthentication.FormsCookieName);
                current.Request.Cookies.Add(GetAuthCookie(clientTicket));
            }
            if (writeResponseCookie)
            {
                if (!current.Request.IsSecureConnection && FormsAuthentication.RequireSSL)
                {
                    throw new HttpException("Connection not secure while creating secure cookie");
                }
                current.Response.Cookies.Add(GetAuthCookie(clientTicket));
            }
        }
public static void SetAuthCookie ( FormsAuthenticationTicket clientTicket , bool overwriteRequestCookie , bool writeResponseCookie ) { Initialize ( ) ; HttpContext current = HttpContext . Current ; if ( overwriteRequestCookie ) { current . Request . Cookies . Remove ( FormsAuthentication . FormsCookieName ) ; current . Request . Cookies . Add ( GetAuthCookie ( clientTicket ) ) ; } if ( writeResponseCookie ) { if ( ! current . Request . IsSecureConnection && FormsAuthentication . RequireSSL ) { throw new HttpException ( " " ) ; } current . Response . Cookies . Add ( GetAuthCookie ( clientTicket ) ) ; } }
Encrypts a FormsAuthenticationTicket in an HttpCookie (using GetAuthCookie)
and includes it in the current Request's Cookies collection and/or the
Response's outbound Cookies collection.
Encrypts a FormsAuthenticationTicket in an HttpCookie ( using GetAuthCookie ) and includes it in the current Request ' s Cookies collection and / or the Response ' s outbound Cookies collection .
clientTicket
FormsAuthenticationTicket
The FormsAuthenticationTicket to encode
The FormsAuthenticationTicket to encode
overwriteRequestCookie
bool
Whether or not to replace the cookie in
the current Request's Cookies collection.  This will trick later executing
code on the current HTTP request into processing the updated cookie
Whether or not to replace the cookie in the current Request ' s Cookies collection . This will trick later executing code on the current HTTP request into processing the updated cookie
writeResponseCookie
bool
Whether or not to write the cookie to the
browser via the Response's Cookies collection.
Whether or not to write the cookie to the browser via the Response ' s Cookies collection .