开发者

Erratic requests arising from client when using a custom view engine in ASP.Net MVC

开发者 https://www.devze.com 2023-01-31 22:43 出处:网络
I have spent about 7 hours trying to figure this out but gotten nowhere. This is how my fiddler trace looks like

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

This is how my fiddler trace looks like

Erratic requests arising from client when using a custom view engine in ASP.Net MVC

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 开发者_StackOverflowtranslate 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.

Erratic requests arising from client when using a custom view engine in ASP.Net MVC


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");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号