1

私は、IE と Firefox で として表示される MVC ルートを持ってhttp://{site}.com/{value}/います。これは、私が期待している適切な形式です。ただし、Chrome の同じルートの最後には余分な疑問符が付きます。すなわちhttp://{site}.com/{value}/?。私が通過しているクエリ文字列変数や余分なデータはありません..また、IEでは正常に機能し、余分な? ルートの終わりに。

余分なものがあるのはなぜですか?URLの最後にあり、どうすればそれを取り除くことができますか? 検索結果のクロールを支援するためにサイトの URL を正規化する任務を負っていますが、これが私の任務を妨げています。また、この余分な文字の出現は、Google や他社の検索エンジンのクロールにも影響しますか?

編集:この値を使用して、コントローラーアクションにルートを設定しています: [GET("{city}-{state}-{zip}/{name}/{entity}")]

public static class AttributeRouting
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        // See http://github.com/mccalltd/AttributeRouting/wiki/3.-Configuration for more options.
        // To debug routes locally using the built in ASP.NET development server, go to /routes.axd
        routes.MapAttributeRoutes(config =>
        {
            config.AppendTrailingSlash = true;
            config.ScanAssembly(Assembly.GetExecutingAssembly());
            config.AddDefaultRouteConstraint(@"^entity$", new RegexRouteConstraint(@"^\d{6,7}$"));
            config.AddDefaultRouteConstraint(@"^address$", new RegexRouteConstraint(@".{3,}$"));
            config.AddDefaultRouteConstraint(@"^stateName$", new RegexRouteConstraint(@"^[^-]+$"));
            config.AddDefaultRouteConstraint(@"^page$", new RegexRouteConstraint(@"[0-9]*?$"));
        });
    }

    public static void Start()
    {
        RegisterRoutes(RouteTable.Routes);
    }
}
4

0 に答える 0