小编Mou*_*adh的帖子

为什么#字符被添加到网址?

我有一个显示缩略图列表的简单页面,

我想添加一个寻呼机,我添加了两个动作链接

  <li class="ui-pagination-next">@Html.ActionLink("Next", "Paginate", "Home", new { nbSkip = ViewBag.nextSkip }, null)</li>
Run Code Online (Sandbox Code Playgroud)

当我点击我重定向到的链接时

http://localhost:41626/#/Home/Paginate?nbSkip=60
Run Code Online (Sandbox Code Playgroud)

代替

http://localhost:41626/Home/Paginate?nbSkip=60 , 
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么'#'字符被添加到URL?

路线copnfig:

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net-mvc actionlink asp.net-mvc-4

5
推荐指数
1
解决办法
840
查看次数

标签 统计

.net ×1

actionlink ×1

asp.net-mvc ×1

asp.net-mvc-4 ×1

c# ×1