Guest User

Untitled

a guest
Apr 4th, 2018
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. WebSecurity.Login(model.Username, model.Password, model.RememberMe)
  2.  
  3. public ActionResult Login(LoginModel model, string returnUrl)
  4. {
  5. if (ModelState.IsValid && !string.IsNullOrEmpty(model.Username) && !string.IsNullOrEmpty(model.Password))
  6. {
  7. if (WebSecurity.UserExists(model.Username))
  8. {
  9. if (WebSecurity.IsConfirmed(model.Username))
  10. {
  11. if (WebSecurity.Login(model.Username, model.Password, model.RememberMe)) // **Exception is thrown at this line**
  12. {
  13. return RedirectUser(model);
  14. }
  15. }
  16. }
  17. }
  18. }
  19.  
  20. [TestMethod]
  21. public void T01_Case106()
  22. {
  23. var ac_controller = DependencyResolver.Current.GetService<AccountController>();
  24. var login_response = ac_controller.Login(_testStudio.LoginModel, string.Empty);
  25. Assert.IsNotNull(login_response);
  26.  
  27. }
  28.  
  29.  
  30. public class TestStudio
  31. {
  32. public LoginModel LoginModel = new LoginModel { Username = "admin@gr.com", Password = "1234567"
  33. };
  34.  
  35. System.NullReferenceException: Object reference not set to an instance of an object.
  36. at System.Web.Security.FormsAuthentication.SetAuthCookie(String userName, Boolean createPersistentCookie, String strCookiePath)
  37. at System.Web.Security.FormsAuthentication.SetAuthCookie(String userName, Boolean createPersistentCookie)
  38. at WebMatrix.WebData.WebSecurity.Login(String userName, String password, Boolean persistCookie)
  39. at Groove.Controllers.Web.AccountController.Login(LoginModel model, String returnUrl) in D:projectGrooveWebGrooveControllersWebAccountController.cs:line 89
Add Comment
Please, Sign In to add comment