我们怎样才能使URL使用属性,mvc5路由#启动 [英] how can we make url starts with# using attribute routing in mvc5
本文介绍了我们怎样才能使URL使用属性,mvc5路由#启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个与像#本地主机开始的URL:/#somename
。谁能帮我?
我试着用自定义路由约束,我没有得到
//本地主机:/#测试
[路线(@{X:正则表达式([^#] *)}测试)]
公众的ActionResult testingyash(字符串x)
{
返回查看();
}
解决方案
您不能有一个这样的URL。在#
符号是一个片段标识符。它使用的浏览器识别页面的部分。凡是继#
甚至没有发送到服务器。
I want to create a url which starts with # like localhost:/#somename
. Can anyone help me?
i tried with custom route constraint,i did not get
//localhost:/#testing
[Route(@"{x:regex([^#]*)}testing")]
public ActionResult testingyash(string x)
{
return View();
}
解决方案
You cant have a url like that. The #
symbol is a Fragment Identifier. Its used by browsers to identify a section in page. Anything following the #
is not even sent to the server.
这篇关于我们怎样才能使URL使用属性,mvc5路由#启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文