Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try to use the following code.</p> <pre><code>protected void LoginButton_Click(object sender, EventArgs e) { try { dtUserDetails = new DataTable(); if (UserRepositoryBL.ValidateUser(LoginUser.UserName.Trim(), LoginUser.Password.Trim(), out dtUserDetails)) { AuthUser au = new AuthUser(); if (dtUserDetails.Rows.Count &gt; 0) { DataRow DR = dtUserDetails.Rows[0]; au.UserID = Convert.ToInt32(DR["UserID"].ToString()); au.UserNo = DR["UserNo"].ToString(); au.UserName = DR["UserName"].ToString(); au.Password = DR["Password"].ToString(); } string userData = au.ToString(); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, // Version number LoginUser.UserName.Trim(), // Username DateTime.Now, // Issue date DateTime.Now.AddMinutes(60), // Expiration date false, // Persistent? userData // User data ); string eticket = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie (FormsAuthentication.FormsCookieName, eticket); Response.Cookies.Add(cookie); BasePage.ActivityLog("User Login", LoginUser.UserName.Trim(), true, Request.RawUrl); string url = FormsAuthentication.GetRedirectUrl(LoginUser.UserName, false); Response.Redirect(url); // FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName, false); } else { LoginUser.FailureText = "Your login attempt was not successful. Please try again."; } } catch (Exception ex) { throw ex; } } </code></pre> <blockquote> <p>dtUserDetails is a out parameter which contains the user details like password,username,etc.. on successful login.datatable returns empty if invalid login.with in userData string all those information will be available.then u can retrieve those from any page using User Authenticated Ticket </p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload