c# - Trying to fire/call OnLoggedIn event from Page_Load event -
i implementing asp.net user membership authentication in website. using asp.net's control
- authenticate user,
- sign new user ,
- change password change authenticated user's password.
my functionality is:
- on sign page, have user name , email inputs , have set the
autogeneratepasswordpropertytrue. - once successful registration system sends out email user url in email (like
http://localhost:xxxx/login.aspx?user=abc10&pwd=something).
my issue is, when user clicks above link, should redirected automatically change password page change password. so, redirection, trying call onloggedin event in page_load.
i have tried below calls page_load event.
login1_loggedin(sender.gettype(), null)login.loggedin += new eventhandler(login1_loggedin)
but event not firing, can help?
finally figured out. had work out 2 scenarios, i. user should able login login page. ii. , when user should able redirect next page following login when he/she clicks link have received in email.
so first point straight forward.
for second point, created method has code logic authenticate user. , called method in page_load() event , onloggedin event.
and in page load, wrote below code simulate login event redirect user directly next page.
protected void page_load(object sender,eventargs e) { string username = usernametextbox.text.trim(); **formsauthentication.setauthcookie(username, true);** calllogin();// method in user authentication logic resides }
Comments
Post a Comment