I have setup a simple login with Forms Authentication that works fine on my localhost in an ASP.NET MVC app
But when I published the website into a live application on the web the Forms Authentication doesn't work. What am I doing wrong?
Here is my code:
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Home/Login" timeout="30" />
</authentication>
</system.web>
Controller:
public ActionResult LoginUser(string useame, string password)
{
if (ConfigurationManager.AppSettings["UserName"] == useame && ConfigurationManager.AppSettings["Password"] == password)
{
FormsAuthentication.SetAuthCookie(useame, false);
retu RedirectToAction("Index");
}
retu RedirectToAction("Index");
}
Javascript:
$("body").on("click", "#loginbutton", function (e) {
$("#loginbutton").attr("href", "/loginuser?useame=" + $('[user]').attr('user') + "&password=" + $('[pass]').attr('pass'));
});
Why does this not work in a live-application?
