How to properly authenticate mvc-mini-profiler with AspNetSqlMembershipProvider

后端 未结 3 825
心在旅途
心在旅途 2021-02-04 07:57

I tried to check if the user is in role at Application_BeginRequest and Application_AuthenticateRequest with this code and it will not work. At BeginRequest the code is never hi

3条回答
  •  梦毁少年i
    2021-02-04 08:56

    Begin request happens before the user is fully authenticated in the request life cycle.

    I solved this issue by adding a cookie if the user is in a role ("Admin" in your case) when the request is authenticated then you can check for this cookie on begin request and initialise the profiler.

    It wont't work the first time but should every time after that.

提交回复
热议问题