c# - Action Filter Attribute does not work correctly with Hub class -


in asp.net web api using action filter attribute override onactionexecuting , onactionexecuted validate token send client in header when adding attribute on controller can intercept request before passing functions in controller till every thing working fine not true if add same attribute on hub class when debug can see methods on hub excuted first onactionexecuting , onactionexecuted. how solve problem.

 [ourauthorization]     public class notificationhub : hub      {         private accplusentities1 db = new accplusentities1();          public void trnaddednotfication(string groupname)         {             clients.othersingroup(groupname).addednotfication();         }          public void trndeletednotfication(string groupname)         {             clients.othersingroup(groupname).deletednotfication();         }          public void joingroup(string accname)         {             var x = basecontroller.currentuser.accid;             groups.add(context.connectionid, accname);         }          public void leavegroup(string accname)         {             groups.remove(context.connectionid, accname);         }          public void lock(int trnid)         {          }     }   

action filter attributes not work signalr hubs you've discovered. fortunately signalr provide it's own authorizeattribute fulfills same purpose.

as actionfilterattributes, can subclass signalr's authorizeattribute , override userauthorized method.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -