Hi
I have below cod but tuple is returning nothing. I want User Id, & Role value
Web.Config <authentication mode="Forms"> <forms name="frmPayroll" loginUrl="Login.aspx" timeout="60" slidingExpiration="true" /> </authentication> Login Form ********** bool success = (bool)successParam.Value; if (success) { Response.Redirect("~/Admin/Department.aspx"); } else { //ShowMessage("Oops...", success.ToString(), "error"); } Department ********** var authenticatedUser = Common.CommonFunction.AuthenticatedUser(); if (authenticatedUser.Item1) // Check if the user is authenticated { var userRole = authenticatedUser.Item2; var loginId = authenticatedUser.Item3; } else { // Handle unauthenticated scenario if needed } AuthenticatedUser ***************** public static Tuple<bool, string, string> AuthenticatedUser() { try { if (HtpContext.Current.User.Identity.IsAuthenticated) { FormsIdentity id = (FormsIdentity)HtpContext.Current.User.Identity; FormsAuthenticationTicket ticket = id.Ticket; return Tuple.Create(true, ticket.UserData, HtpContext.Current.User.Identity.Name); } else { FormsAuthentication.RedirectToLoginPage(); return Tuple.Create(false, string.Empty, string.Empty); } } catch (Exception ex) { FormsAuthentication.RedirectToLoginPage(); return Tuple.Create(false, string.Empty, string.Empty); } }
Thanks