title: Account creation via Form authentication ASP.NET MVC page
body: <p>I'm working on an intranet, so far I have switched from Windows authentication to <strong>Form authentication</strong> and I'm able to connect / register etc.</p>
  
  <p>But here's what I'm expected to do : Instead of being able to create and account through the usual forms route, I wish to <strong>link the list of employees</strong> (that has <em>many parameters</em>, such as Login, Password, Name etc.) and be able to <strong>create a new user when I create a new Employee.</strong></p>
  
  <p>Here is my Employee creation controller :</p>
  
  <pre><code>public ActionResult Create()
      {
          ViewBag.CompanyList = _service.ListCompany();
          ViewBag.SupervisorList = _service.ListSupervisor();
  
          return View();
      }
  
      //
      // POST: /Employee/Create
  
      [HttpPost]
      public ActionResult Create([Bind(Exclude = "Id")] Employee objEmployee, FormCollection form)
      {            
          ViewBag.CompanyList = _service.ListCompany();
          ViewBag.SupervisorList = _service.ListSupervisor();
  
          objEmployee.CreatedDate = System.DateTime.Now;
          objEmployee.UpdatedDate = System.DateTime.Now;
          objEmployee.CompanyId = int.Parse(form["CompanyId"]);
          objEmployee.Supervisor = form["Supervisor"];
  
          if (_service.Create(objEmployee))
              return new RedirectResult(Url.Action("Index"));
  
          else
          {
              if (!_service.Validate(objEmployee))
                  return View();
              else
                  return new RedirectResult(Url.Action("Index", "Error", new { Message = "Error Create Employee", NextPage = CRAWebSiteMVC.Properties.Resources.Employee + @"/" + CRAWebSiteMVC.Properties.Resources.Create }));
          } 
      }
  </code></pre>
  
  <p>And here's the <em>usual</em> way I create an account via the normal form auth. registering :</p>
  
  <pre><code>    [HttpPost]
      [AllowAnonymous]
      [ValidateAntiForgeryToken]
      public ActionResult Register(RegisterModel model)
      {
          if (ModelState.IsValid)
          {
              // Attempt to register the user
              try
              {
                  WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
                  WebSecurity.Login(model.UserName, model.Password);
                  return RedirectToAction("Index", "Home");
              }
              [...]
          }
  
          // If we got this far, something failed, redisplay form
          return View(model);
      }
  </code></pre>
  
  <p><strong>How may I create an account via the Employee creation panel and basically replace the usual user list by the employee list?</strong></p>