在ASP.NET Core中将链接参数添加到带有井号(#)锚URL的asp标记助手中 [英] Add link parameter to asp tag helpers with pound sign (#) anchor url in ASP.NET Core

查看:300
本文介绍了在ASP.NET Core中将链接参数添加到带有井号(#)锚URL的asp标记助手中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下网址http://localhost:5000/Home/Index/#test,我需要将#test传递给操作.我使用了asp-route="#test"asp-route-id="#test",但是它们不起作用.

I have the following url http://localhost:5000/Home/Index/#test and I need to pass the #test to the action. I used asp-route="#test"and asp-route-id="#test" but they does not work.

这是我的动作

public ActionResult Index(string id)
{
    return View();
}

推荐答案

尝试使用使用类似标签的助手

<a asp-action="Index" asp-controller="Home" asp-route-id="#test">Index</a>

这篇关于在ASP.NET Core中将链接参数添加到带有井号(#)锚URL的asp标记助手中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆