Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC 3 FormsAuthentication Not working when deployed
    primarykey
    data
    text
    <p>I have an MVC 3 Application that works fine in my dev environment (you must have heard that before..) I am deploying it to a free hosting service <a href="http://somee.com" rel="nofollow">http://somee.com</a> for testing, the .NET framework is set to 4. I have a custom membership provider. I am able to register a user, as I can see it in the database, but <strong>the user never gets authenticated.</strong> I always get redirected to the LogOn page, either after the registration or when loging on. I have done a bin deployment and have this dlls in my bin folder: </p> <p>•System.Web.Mvc<br> •Microsoft.Web.Infrastructure<br> •System.Web.Razor<br> •System.Web.WebPages •System.Web.WebPages.Razor<br> •System.Web.Helpers </p> <p>In the config: ...</p> <pre><code> &lt;add key="loginUrl" value="~/Account/Logon" /&gt; &lt;/appSettings&gt; .... &lt;membership defaultProvider="ServiceMembershipProvider"&gt; &lt;providers&gt; &lt;clear/&gt; &lt;add name="ServiceMembershipProvider" type="Infrastruture.ServiceMembershipProvider, Infrastruture" /&gt; &lt;/providers&gt; &lt;/membership&gt; &lt;authentication mode="Forms"&gt; &lt;forms loginUrl="~/Account/LogOn" timeout="2880" /&gt; &lt;/authentication&gt; </code></pre> <p>The controllers: </p> <pre><code> [HttpPost] public ActionResult Register(FormCollection registration) { try { if (ModelState.IsValid) { var registrationViewModel = MapFormToRegistrationViewModel(registration); companyManager.RegisterCompany(registrationViewModel); FormsAuthentication.SetAuthCookie(registrationViewModel.SystemUserViewModel.Email, false); return RedirectToAction("Welcome", "Home"); } else { ModelState.AddModelError("", "LogId already taken"); } } catch(Exception ex) { return View("Register", new RegistrationViewModel(dataReferenceService)); } return View("Register", new RegistrationViewModel(dataReferenceService)); } /* /Home/Welcome */ [Authorize] public ActionResult Welcome() { return View(); } </code></pre> <p>Running out of ideas now ...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload