protected void LoginButton_Click(object sender, EventArgs e) { errorwrapper.Visible = false; HPMCredentialResolutionSessionIDsEnum sessionIDs = new HPMCredentialResolutionSessionIDsEnum(); Array.Resize(ref sessionIDs.m_SessionIDs, 1); HPMString user = UserNameField.Text; HPMString password = PasswordField.Text; sessionIDs.m_SessionIDs[0] = Convert.ToUInt64(ChannelList.SelectedItem.Value); HPMUniqueID userID = new HPMUniqueID(-1); try { HPMChangeCallbackData_AuthenticationResolveCredentialsResponse response = m_VirtSession.AuthenticationResolveCredentialsBlock(user, password, sessionIDs); userID = response.m_ResourceID; if (userID.m_ID == -1) { SetErrorMessage("Could not authenticate user", ""); } HPMSdkSession.SessionDestroy(ref m_VirtSession); } catch (HPMSdkException error) { SetErrorMessage("Could not authenticate user", error.ErrorAsStr()); } catch (HPMSdkManagedException error) { SetErrorMessage("Could not authenticate user", error.ErrorAsStr()); } if (userID != -1) { HttpCookie aCookie = new HttpCookie("hansoftuser"); aCookie.Value = user; Response.Cookies.Add(aCookie); FormsAuthentication.RedirectFromLoginPage(Convert.ToString(userID.m_ID), false); } }
protected void LoginButton_Click(object sender, EventArgs e) { errorwrapper.Visible = false; HPMCredentialResolutionSessionIDsEnum sessionIDs = new HPMCredentialResolutionSessionIDsEnum(); Array.Resize(ref sessionIDs.m_SessionIDs, 1); HPMString user = UserNameField.Text; HPMString password = PasswordField.Text; sessionIDs.m_SessionIDs[0] = Convert.ToUInt64(ChannelList.SelectedItem.Value); HPMUniqueID userID = new HPMUniqueID(-1); try { HPMChangeCallbackData_AuthenticationResolveCredentialsResponse response = m_VirtSession.AuthenticationResolveCredentialsBlock(user, password, sessionIDs); userID = response.m_ResourceID; if (userID.m_ID == -1) { SetErrorMessage("Could not authenticate user", ""); } HPMSdkSession.SessionDestroy(ref m_VirtSession); } catch (HPMSdkException error) { SetErrorMessage("Could not authenticate user", error.ErrorAsStr()); } catch (HPMSdkManagedException error) { SetErrorMessage("Could not authenticate user", error.ErrorAsStr()); } if (userID != -1) { HttpCookie aCookie = new HttpCookie("hansoftuser"); aCookie.Value = user; Response.Cookies.Add(aCookie); FormsAuthentication.RedirectFromLoginPage(Convert.ToString(userID.m_ID), false); } }