English 中文(简体)
地图(Asp.Net MVC 2.0 .NET 4.0)
原标题:MapRoute (Asp.Net MVC 2.0 .NET 4.0)

是否有绘制地图的可能性,该地图将永远使用一种方法,并且必须打赢才能解决这一问题?

我指的是采用一种方法(Index)的维登控制器,其显示的物品取决于方法论点。

public ActionResult Index(string TabName)
    {
        var tab = (from t in BlogDB.Tabs
                   where t.TabName == TabName
                   select t).SingleOrDefault();

        ViewData.Model =(Tab)tab;
        return View();
    }

我想的是,我可以展示在塔克斯和塔巴尼亚美之间没有“Index/”的“www.example.com/Tabs/TabName”的节目。 我尝试:

    routes.MapRoute(
        "Tabs1",
        "Tabs/{TabName}",
        new { controller = "Tabs", action = "Index", TabName = UrlParameter.Optional }
    );

但它没有工作。

最佳回答

您是否还有违约路线? 是的?

你的问题是,Asp.net mvc试图找到塔克斯控制员和塔比特行动。

在违约之前将这条路线推到{控制员}/} 路线

问题回答

暂无回答




相关问题
Developing Azure .Net 4.0 Applications

Presently .Net 4.0 is not supported on Azure. This thread indicates that you will not be able to use .Net 4.0 with VS 2010 until it is supported in the cloud. http://social.msdn.microsoft.com I d ...

Entity Framework error when submitting empty fields

VS 2010 Beta 2, .NET 4. In my ASP.NET MVC 2 application, when I submit a form to an action method that accepts an object created by the entity framework, I get the following error: Exception Details:...

log4net with .NET 4.0

I ve thrown together some code to tinker with the new .Net 4.0/VS 2010 pieces, but I can t seem to find a build of my logging framework of choice (log4net) for 4.0, and I m getting reference errors ...

MembershipProvider in .NET 4.0

How can I add the MembershipProvider class to my .NET 4.0 project in VS 2010 B2? I want to customize a MembershipProvider, but I cannot without adding this class. Please guide me through this process....

.NET 4.0 on Windows Azure?

My google-fu is failing me on this one. As a possible solution to Unit Testing .NET 3.5 projects using MStest in VS2010 (but I ve put this in a seperate question because it s kind of unrelated): Is ...

热门标签