IIS 7.5在ASP网Web应用程序重定向到登录页面,但登录后给出错误HTTP 404.0 [英] asp net web application under IIS 7.5 redirect to a login page but gives error http 404.0 after log-in

查看:388
本文介绍了IIS 7.5在ASP网Web应用程序重定向到登录页面,但登录后给出错误HTTP 404.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用ASP NET MVC应用程序一个发达和我已经配置在IIS虚拟direcotry。

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

我可以访问位于HTTP服务器的文件夹,也我的应用程序:本地主机:8081 /应用程序

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

我重定向到位于/帐号/登录一个登录页面,如预期,但是当我登录使用我的用户名/密码,我得到一个HTTP ERRO 404.0 - 未找到

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.

为什么这种行为?

编辑:

控制器:

    //
    // 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 }
        );
    }
}

}

推荐答案

这个问题是不是与我的ASP网应用程序,但与IIS配置。
负责IIS的人解决问题。谢谢

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

这篇关于IIS 7.5在ASP网Web应用程序重定向到登录页面,但登录后给出错误HTTP 404.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆