Posted By

box86rowh on 09/07/12


Tagged

login c# DNN


Versions (?)

Easy login method for DNN based web sites


 / Published in: C#
 

Just a quick down and dirty login function I use.

  1. public void LogIn(object sender, EventArgs e)
  2. {
  3. //do login
  4. UserLoginStatus loginStatus = UserLoginStatus.LOGIN_FAILURE;
  5. UserInfo objUserInfo = UserController.ValidateUser(0, txtUser.Text,txtPassword.Text, "DNN", "", PortalSettings.PortalName, this.Request.UserHostAddress, ref loginStatus);
  6. if (loginStatus == UserLoginStatus.LOGIN_SUCCESS || loginStatus == UserLoginStatus.LOGIN_SUPERUSER)
  7. {
  8. bool isPersistent = false;
  9.  
  10. //User login
  11. UserController.UserLogin(0, objUserInfo, PortalSettings.PortalName, this.Request.UserHostAddress, isPersistent);
  12. Response.Redirect("/");
  13. }
  14. else
  15. {
  16. //show fail...
  17. errorBox.Visible = true;
  18. }
  19. }

Report this snippet  

You need to login to post a comment.