gpt4 book ai didi

ASP.NET 路由 : RouteCollection class missing

转载 作者:行者123 更新时间:2023-12-01 10:15:29 26 4
gpt4 key购买 nike

我正在 VS 2008(带有 SP1)中开发一个网站(Web 表单,而不是 MVC)。我正在尝试合并 ASP.NET 路由。我正在按照 MSDN 教程进行操作。
http://msdn.microsoft.com/en-us/library/cc668201.aspx
我已按照教程将以下项目添加到我的 glbal.asax.cs 文件中

 protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);

}

public static void RegisterRoutes(RouteCollection routes)
{

routes.Add(new Route
(
"Category/{action}/{categoryName}"
, new CategoryRouteHandler()
));
}

尝试构建时,它会告诉我们“找不到类型或命名空间名称‘RouteCollection’(您是否缺少 using 指令或程序集引用?)

我已将 System.web 导入到我的 global.asax 文件中

任何想法如何摆脱它?

最佳答案

您还需要导入 System.Web.Routing。

关于ASP.NET 路由 : RouteCollection class missing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1213567/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com