문제

I have a mvc3 based web service which uses Ninject to manage its action filters, which all works fine. However now I am having to implement a SignalR hub into the mix and ideally want to re-use the existing action filters on these new hubs if possible.

One of the most important filters is the CookieAuthentication filter, which basically checks that a given request contains the right authentication cookie, if the cookie is not present or valid it sets the filtercontext.result object to a custom UnauthorisedResult object. So in this example are you able to use this functionality as SignalR to my knowledge has no idea about action results so not sure if it would automatically cancel requests etc.

I have tried googling but cannot find much info on the topic, I assume you cannot intermingle them as both frameworks only share the underlying ASP framework not the MVC framework.

도움이 되었습니까?

해결책

You can't. ActionFilters are for MVC only and don't run when using SignalR. The only common ground (as you realize) is ASP.NET itself. That means you can write an HttpModule but not an action filter.

You can learn more about SignalR security here: http://www.asp.net/signalr/overview/security

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top