我正在關注亞當弗里曼的這本書Pro.ASP.NET.MVC.3.Framework。 所以我下載了代碼,並在他的菜單類別中生成了這個html代碼。亞當弗里曼書Pro.ASP.NET.MVC.3.Framework中的錯誤
的HTML:
<a class="" href="/Chess%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20">Chess </a>
當我按下鏈接(明顯),其結果是:
http://localhost:43190/Chess%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
我不知道別人有這本書的這個問題。
我嘗試在我的Global.asax:
routes.IgnoreRoute("favicon.ico");
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
在我的佈局:
<link rel="shortcut icon" href="@Url.Content("~/Content/themes/base/images/favicon.ico")" type="image/x-icon" />
在我ninject控制器:
protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
{
if (controllerType != null)
{
return (IController)ninjectKernel.Get(controllerType);
}
else
{
return base.GetControllerInstance(requestContext, controllerType);
}
}
我不知道是否有人與我有同樣的問題。我該如何解決這個問題?
好吧我明白知道我的sql是nvarchar,所以它生成的空白空間,我更改爲varchar,並知道不生成blanck空間 –