且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我们怎样才能使URL使用属性,mvc5路由#启动

更新时间:2023-02-21 18:21:29

您不能有一个这样的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.