Search code examples
asp.netasp.net-mvciisasp.net-mvc-4iis-7.5

asp net web application under IIS 7.5 redirect to a login page but gives error http 404.0 after log-in


I have a application developed using ASP NET MVC and I have configured a virtual direcotry in IIS.

I can access the server folder and also my app located in http:localhost:8081/application

I am redirect to a login page located /Account/Login as expected but when I log in using my username/password I am getting an Erro HTTP 404.0 - Not Found.

Why this behavior?

Edit:

Controller:

    //
    // POST: /Account/Login
    [HttpPost]
    [ValidateAntiForgeryToken]
    [AllowAnonymous]
    public ActionResult Login(LoginModel model, string returnUrl)
    {
        MembershipProvider mp = Membership.Provider;

        if (ModelState.IsValid && mp.ValidateUser(model.UserName, model.Password))
        {
            FormsAuthentication.SetAuthCookie(model.UserName, false);
            return RedirectToAction("Index", "Home");
        }

        // If we got this far, something failed, redisplay form
        ModelState.AddModelError("", "Username ou Password incorreto!.");

        return View(model);
    }  

RouteConfig:

namespace tgpwebged { public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }
        );
    }
}

}


Solution

  • The problem was not with my asp net app, but with the IIS configuration. Guys in charge of IIS fix the problem. Thanks