ASP.Net MVC & Comet (WebSync)

核能气质少年 提交于 2019-12-21 21:52:51

问题


I'm trying to implement comet in my ASP.Net MVC 2.0 project. I'm using WebSync from FrozenMountain. My website is coded in C# 4.0 and ASP.Net 4.0.

The comet code is triggering my MVC controller function with the [HttpPost] attribute (even though the page doesn't refresh or appear to post). Is there a way to determine what is being posted and ignore that route in my global.asax.cs?

  • Please note, I know how to ignore routes with MVC, that is not the issue.

回答1:


The gentlemen at Frozen Mountain helped me solve the problem here

It was hitting one of my MVC controller functions. I had to add this to my global.asax.cs

routes.IgnoreRoute("{*allashx}", new {allashx=@".*\.ashx(/.*)?"}); 



回答2:


In WebSync 4, you can skip the .ashx handler altogether and just add a route for WebSync directly in Global.asax:

WebSyncServer.AddRoute("...");


来源:https://stackoverflow.com/questions/3241246/asp-net-mvc-comet-websync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!