MVC页面未找到问题 [英] MVC Page not found issue

查看:121
本文介绍了MVC页面未找到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai朋友,
我创建了一个新的MVC2项目,并将SetUpStartPage设置为登录页面,然后在该页面中运行.它抛出未找到页面的问题.我下一步该怎么办?如何避免这个错误?请帮助我.

感谢您的进步.

Hai friends ,
I have created a new MVC2 Project and Set SetUpStartPage to logon page then, run in the page. It throw page not found issue. What will i do next ? How to avoid this error ? Pls help me.

Thanks for advance.

推荐答案

该页面(视图)可能没有匹配的控制器或动作.首先,为什么需要在此处使用Setstartuppage选项?使用defaults路由.
检查本文中的示例代码
ASP.NET MVC中的路由基础 [
Probably there''s no matching controller or action for that page(View). First of all, why do you need to use Setstartuppage option here? Use defaults route.
Check the sample code from this article
Routing Basics in ASP.NET MVC[^]
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 = "Home", 
                action = "Index", 
                id = UrlParameter.Optional
            }
        );
    }
}


这篇关于MVC页面未找到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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