默认页面找不到资源 [英] resource not found by default page

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

问题描述

I have just started the mvc 3 with razor engine, added 1st view as addcountry, it's controller,
Controller code is here, but debug is not coming at this index, where was i mistaken, should i change the route ?




public ActionResult Index()
{
return View();
}







the image of resource not found is here,
http://tinypic.com/view.php?pic=2zqy7oh&s=8

if i write path as

http://localhost:44674/AddCountry/Index

then it opens the page,but i want to open the page without any manually writing of path.

I added view after controller & by right click below code & then click on add view







public ActionResult Index()
{
return View();
}





我的路线





My route
is

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

          routes.MapRoute(
              "", // Route name
              "{controller}/{action}/{id}", // URL with parameters
              new { controller = "AddCountry", action = "Index", id = UrlParameter.Optional } // Parameter defaults
          );
  //        routes.MapRoute(
  //            "Home", // Route name
  //            "{controller}/{action}/{id}", // URL with parameters
  //            new
  //            {
  //                controller = "AddCountry",
  //                action = "Index",
  //                id = UrlParameter.Optional
  //            } // Parameter defaults
  //);

      }

推荐答案

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

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