Model view controller MvcHtmlString MVC 2转换错误

Model view controller MvcHtmlString MVC 2转换错误,model-view-controller,asp.net-mvc-2,Model View Controller,Asp.net Mvc 2,我从MVC 1转换到MVC 2,Visual Studio 2008给了我以下错误: Error 1 'System.Web.Mvc.MvcHtmlString' does not contain a definition for 'Substring' and no extension method 'Substring' accepting a first argument of type 'System.Web.Mvc.MvcHtmlString' could be found (

我从MVC 1转换到MVC 2,Visual Studio 2008给了我以下错误:

Error   1   'System.Web.Mvc.MvcHtmlString' does not contain a definition for 'Substring' and no extension method 'Substring' accepting a first argument of type 'System.Web.Mvc.MvcHtmlString' could be found (are you missing a using directive or an assembly reference?) C:\Dev\SapientFansite\SapientFansiteApplication\SapientFansiteWeb\Code\ExtensionMethods\Html.cs 68  75  SapientDevelopment.SapientFansite.Web
这是错误指向的代码。它在“linkHtml.Substring(0,2)”方面特别有问题


我怀疑它与缺少引用或其他东西有关,但我不知所措。

Html.ActionLink()
不再返回字符串。它现在返回一个MvcHtmlString。MvcHtmlString没有名为
.Substring()
的方法(只有string有)。如果调用
.ToString()
.ToHtmlString()
(将对值进行编码),则可以调用
.Substring()
。瞧。

谢谢,这就成功了。ActionLink似乎对我施加了很大的压力
     var linkHtml = htmlHelper.ActionLink(linkText, actionName, controllerName);
     if (isActiveMenuItem) {
        linkHtml = string.Format("{0} class=\"active\" {1}", linkHtml.Substring(0, 2), linkHtml.Substring(3));
     }
     return linkHtml;
     }