Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my code of login(if it's Admin he will give him Admin Role) :
C#
[HttpPost]
       public ActionResult Logpage(LogModel.Login Model)
       {
           if (ModelState.IsValid)
           {

               if (LogModel.Login.Verifuser(Model.IDUser, Model.Password))
               {
                   if (LogModel.Login.IsActive(Model.IDUser, Model.Password))
                   {
                       FormsAuthentication.SetAuthCookie(Model.IDUser, false);
                       if (LogModel.Login.IsAdmin(Model.IDUser, Model.Password))
                       {
                           Roles.AddUserToRole(Model.IDUser, "Admin");
                           return RedirectToAction("Index", "Admin");
                       }
                       else
                       {
                           return RedirectToAction("Index", "Agence",Model.IDUser);
                       }
                   }
                   else
                   {
                       ModelState.AddModelError("", "Compte Desactive Vieullez contactez l'admin SVP");
                   }
               }
               else
               {
                   ModelState.AddModelError("", "Invalide username or Password");
                 return View(Model);
               }
           }
           return View(Model);
       }

the problem that on this line Roles.AddUserToRole(Model.IDUser, "Admin"); i got this error System.Configuration.Provider.ProviderException: .
Posted
Comments
ZurdoDev 10-Apr-12 16:35pm    
What is the rest of the error?
Reza Ahmadi 11-Apr-12 4:58am    
You need to reconsider your RoleProvider section of the web.config or machine.config

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900