Sholo.Web.Security/Authentication/User/UserAuthentication.cs
/// <summary>
/// Creates a FormsAuthenticationTicket for storage on the client.
/// The UserData field contains the server key, which can be 
/// used by the server-side Provider to retrieve validation data 
/// and additional details about the ticket (e.g. IP address)
/// </summary>
/// <param name="username">User associated with the ticket</param>
/// <param name="cookiePath">Relative path on server in which cookie is valid</param>
/// <param name="serverKey">Provider key</param>
/// <param name="validFromDate">Ticket valid from date</param>
/// <param name="validUntilDate">Ticket valid to date</param>
/// <param name="persistent">Ticket can persist across browser sessions</param>
/// <returns>Instance of a FormsAuthenticationTicket</returns>
Creates a FormsAuthenticationTicket for storage on the client.
The UserData field contains the server key, which can be
used by the server-side Provider to retrieve validation data
and additional details about the ticket
Creates a FormsAuthenticationTicket for storage on the client . The UserData field contains the server key which can be used by the server - side Provider to retrieve validation data and additional details about the ticket
public static FormsAuthenticationTicket CreateFormsAuthTicket(string username, string cookiePath, string serverKey, DateTime? validFromDate, DateTime? validUntilDate, bool persistent)
        {
            if (username == null)
            {
                throw new ArgumentNullException("username", "username parameter cannot be null or empty.");
            }
            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentException("username parameter cannot be null or empty.", "username");
            }
            Initialize();
            DateTime fromDate = validFromDate.HasValue ? validFromDate.Value : DateTime.Now;
            DateTime toDate = validUntilDate.HasValue ? validUntilDate.Value : fromDate.Add(FormsTimeout);
            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
                2,
                username,
                fromDate,
                toDate,
                persistent,
                serverKey ?? string.Empty,
                cookiePath ?? FormsAuthentication.FormsCookiePath
            );
            return ticket;
        }
public static FormsAuthenticationTicket CreateFormsAuthTicket ( string username , string cookiePath , string serverKey , DateTime ? validFromDate , DateTime ? validUntilDate , bool persistent ) { if ( username == null ) { throw new ArgumentNullException ( " " , " " ) ; } if ( string . IsNullOrEmpty ( username ) ) { throw new ArgumentException ( " " , " " ) ; } Initialize ( ) ; DateTime fromDate = validFromDate . HasValue ? validFromDate . Value : DateTime . Now ; DateTime toDate = validUntilDate . HasValue ? validUntilDate . Value : fromDate . Add ( FormsTimeout ) ; FormsAuthenticationTicket ticket = new FormsAuthenticationTicket ( 2 , username , fromDate , toDate , persistent , serverKey ?? string . Empty , cookiePath ?? FormsAuthentication . FormsCookiePath ) ; return ticket ; }
Creates a FormsAuthenticationTicket for storage on the client.
Creates a FormsAuthenticationTicket for storage on the client .
/*
            if (serverKey == null)
            {
                throw new ArgumentNullException("serverKey", "serverKey parameter cannot be null or empty.");
            }
            else if (string.IsNullOrEmpty(serverKey))
            {
                throw new ArgumentException("serverKey parameter cannot be null or empty.", "serverKey");
            }                
            */
Instance of a FormsAuthenticationTicket
Instance of a FormsAuthenticationTicket
username
string
User associated with the ticket
User associated with the ticket
cookiePath
string
Relative path on server in which cookie is valid
Relative path on server in which cookie is valid
serverKey
string
None
validFromDate
DateTime?
Ticket valid from date
Ticket valid from date
validUntilDate
DateTime?
Ticket valid to date
Ticket valid to date
persistent
bool
Ticket can persist across browser sessions
Ticket can persist across browser sessions