在 ASP.Net MVC 中使用自定义视图引擎时,客户端发出不稳定的请求

发布于 2024-10-08 10:28:41 字数 943 浏览 6 评论 0原文

我花了大约 7 个小时试图解决这个问题,但一无所获。

这就是我的小提琴手痕迹的样子 alt text

我有两条如下所示的为此页面注册的路线。

[route name="DummyResultsWithMarketStateNames" url="DummyResults/state-{statename}/market-{marketname}/page-{page}/{action}"
   controller="DummyResults" action="Show"/]


[route name="DummyResultsWithMarketId" url="DummyResults/market-{marketid}/page-{page}/{action}"
      controller="DummyResults" action="Show"/]

对于此 url,第一个路由匹配并且它会转到正确的操作。但是,客户端在一秒钟后发送另一个请求,其中删除了最后一个参数“page-1”并将其替换为“none”。我追踪过 XHR,但没有。我不确定这是否是 MVC 框架本身的问题,但这如何转换为来自客户端的请求?!!!另外,我在不同的浏览器中得到不同的行为(上面的 IE 跟踪)。有人遇到过这种奇怪的行为吗?如果您愿意,我很乐意提供更多信息。

更新:

我在 IIS 上设置了该站点,并消除了所有图像、CSS 或脚本请求。我最终还是收到了多个请求。在我删除 .htc 后,原始的虚拟结果页面似乎现在可以工作。但是,我有另一个页面(下面的屏幕截图)不是“合作”的。我应该为某些分机添加忽略路由吗?这让我发疯!请原谅图像上的“嘟嘟声”(IP 原因)。 PS:我设置了另一个站点来提供所有静态资源。

替代文本

I have spent about 7 hours trying to figure this out but gotten nowhere.

This is how my fiddler trace looks like
alt text

I have two routes that look like below that are registered for this page.

[route name="DummyResultsWithMarketStateNames" url="DummyResults/state-{statename}/market-{marketname}/page-{page}/{action}"
   controller="DummyResults" action="Show"/]


[route name="DummyResultsWithMarketId" url="DummyResults/market-{marketid}/page-{page}/{action}"
      controller="DummyResults" action="Show"/]

For this url, the first route matches and it goes to the right action. However, the client is sending in another request a second later in which it removes the last parameter 'page-1' and replaces it with 'none'. I've traced for XHR's and there are none. I'm not sure if this is an issue with the MVC framework itself but how would that translate as a request from the client?!!! Also, I'm getting different behavior with different browsers (IE trace above). Anyone encountered such strange behavior? I'd be happy to provide more info if you'd like.

UPDATE:

I setup the site on IIS and eliminated all image, css or script requests. I still end up with multiple requests. The original dummyresults page seems to be working now after I removed the .htc's. However, I have another page (screenshot below) that is not 'co-operating'. Should I add Ignoreroutes for certain extensions? This is driving me nuts!!! Pardon the 'bleep' on the image (IP reasons). PS: I setup another site for serving up all static resources.

alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千紇 2024-10-15 10:28:41

问:我应该为某些分机添加 Ignoreroutes 吗?
答:当然!默认情况下,WCF 扩展名“*.svc”被忽略。我在新页面上添加的第一件事是 favicon.ico 的忽略规则。

RouteTable.Routes.IgnoreRoute("*.svc");
RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
RouteTable.Routes.IgnoreRoute("favicon.ico");

Q: Should I add Ignoreroutes for certain extensions?
A: Of course! By default the WCF extension "*.svc" is ignored. The first thing I add on a ne page is for instance the ignore rule for the favicon.ico.

RouteTable.Routes.IgnoreRoute("*.svc");
RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
RouteTable.Routes.IgnoreRoute("favicon.ico");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文