Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 如何让ASP.NETMVC忽略&;“用户界面页面”;是否通过jQuery Mobile添加到URL?_Asp.net Mvc_Jquery Mobile - Fatal编程技术网

Asp.net mvc 如何让ASP.NETMVC忽略&;“用户界面页面”;是否通过jQuery Mobile添加到URL?

Asp.net mvc 如何让ASP.NETMVC忽略&;“用户界面页面”;是否通过jQuery Mobile添加到URL?,asp.net-mvc,jquery-mobile,Asp.net Mvc,Jquery Mobile,我有一个ASP.Net MVC站点,它使用jQuery Mobile 1.3。 在某些情况下,jQuery Mobile会将您带到以下URL: http://{domain}/{controller}/{action}/{id}&ui-page={jQueryMobile.PageId} 如何设置我的网站,使MVC忽略&ui页面=以及之后的所有内容 我相信第一步是设置一些东西,这样当URL中有“&”时,MVC就不会抛出验证错误。为此,我将以下内容添加到web.config <sy

我有一个ASP.Net MVC站点,它使用jQuery Mobile 1.3。

在某些情况下,jQuery Mobile会将您带到以下URL:

http://{domain}/{controller}/{action}/{id}&ui-page={jQueryMobile.PageId}
如何设置我的网站,使MVC忽略
&ui页面=
以及之后的所有内容

我相信第一步是设置一些东西,这样当URL中有
“&”
时,MVC就不会抛出验证错误。为此,我将以下内容添加到web.config

<system.web>
  <httpRuntime requestPathInvalidCharacters="&lt;,&gt;,*,%,:,\" />

你能发布你的路由规则,一个抛出错误的示例url和抛出错误的文本吗?@CAbbott:我已经用我的路由更新了这个问题。不过这只是默认路线。你能把收到的错误发出去吗?默认情况下,MVC中的automapper不会映射您在httppost中传递的任何其他参数;它不会抛出错误。@CAbbott:只是澄清一下:您看到,{id}和&ui页面是连接在一起的,对吗?例如:{action}/225&ui页面=blah@CAbbott:在回答您的问题时,我得到的错误是它无法解析{id}或找到作为Guid或类似Guid的{id}。当然,原因是Guid的末尾有“&ui页面”。如果我有创意并在两者之间插入一个“c”(例如“{action}/235/&ui页面”),那么我会得到一个404。
routes.MapRoute(
  name: "Default",
  url: "{controller}/{action}/{id}",
  defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);