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 theautogeneratepassword property true.
  • 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.

  1. login1_loggedin(sender.gettype(), null)
  2. 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

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -