Hello guys,

I have a task to install nopCommerce to a server which only supports .NET 3.5. The thing is that I want to use MVC so I had to change the front-end. Everything works fine except the login control. I have developed my own and the problem is that I am using this code:


StoreMembershipProvider provider = new StoreMembershipProvider();

        public AccountController()
        {
            NameValueCollection nvc = new NameValueCollection();
            nvc.Add("connectionStringName", "NopSqlConnection");
            nvc.Add("enablePasswordReset", "true");
            nvc.Add("requiresQuestionAndAnswer", "false");
            nvc.Add("applicationName", "NopCommerce");
            nvc.Add("requiresUniqueEmail", "true");
            nvc.Add("enablePasswordRetrieval", "true");
            provider.Initialize("NopMembershipSqlProvider", nvc);
        }

        public ActionResult Index()
        {
            
            return View();
        }

        [HttpPost]
        public ActionResult LogIn(string Email, string Password, string ReturnUrl)
        {
            if (ReturnUrl.Contains("?error=true"))
            {
                ReturnUrl = ReturnUrl.Replace("?error=true", "");
            }

            if (provider.ValidateUser(Email, Password))
            {                            
                
                return Redirect(ReturnUrl);
            }
            else
            {
                return Redirect(ReturnUrl + "?error=true");
            }
        }


The Email, Password and ReturnUrl are all correct. The problem is that the method provider.ValidateUser(Email, Password) returns good result every time but the NopContext remains empty (null). Can you please give me some advice.

Thank you very much