ASP.NET MVC - CustomeAuthorize filter action using an external website for loggin in the user

前端 未结 3 1676
轮回少年
轮回少年 2020-12-16 05:36

I have a CustomeAuthorize action filter that forwards the user to signin page if user is not authenticated. I apply this filter to actions or controllers.

[         


        
3条回答
  •  醉话见心
    2020-12-16 06:16

    You can add a judgement by jQuery on the login page.

    $(function () {
            if (window != top) {
                top.location.href = location.href;
            }
        });   
    

    OR

    edit 'filterContext.Result' in action 'OnActionExecuting'

    filterContext.Result = new ContentResult() { Content = "" };
    

提交回复
热议问题