Hi @Mohammad Qasim ,
You can refer to the following code to login sharepoint 2019
private void SignInUser()
{
var mem = (MyMembershipProvider) Utils.BaseMembershipProvider();
var role = (MyRoleProvider) Utils.BaseRoleProvider();
if (!mem.ValidateUser(_userName, _password))
{
return;
}
SecurityToken token = SPSecurityContext.SecurityTokenForFormsAuthentication
(new Uri(SPContext.Current.Web.Url),
mem.Name,
role.Name,
_userName,
_password,
_remember);
SPFederationAuthenticationModule.Current.SetPrincipalAndWriteSessionToken(token);
Response.Redirect(Request.QueryString["Source"]);
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.