protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext, IFacebookApplication settings)
        {
            Contract.Requires(filterContext != null);
            Contract.Requires(filterContext.HttpContext != null);
            Contract.Requires(filterContext.HttpContext.Request != null);
            Contract.Requires(filterContext.RouteData != null);
            Contract.Requires(filterContext.Controller != null);
            Contract.Requires(settings != null);

            var model = new FacebookAuthorizeInfo(
                GetLoginUrl(settings, filterContext.HttpContext, null),
                Perms,
                filterContext.HttpContext.Request.QueryString.AllKeys.Contains("error_reason"),
                filterContext.RouteData.Values);

            var viewResult = new ViewResult
                                       {
                                           MasterName = Master,
                                           ViewName = View,
                                           ViewData = new ViewDataDictionary<FacebookAuthorizeInfo>(model),
                                           TempData = filterContext.Controller.TempData
                                       };

            filterContext.Result = viewResult;
        }
        protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext, IFacebookApplication settings)
        {
            Contract.Requires(filterContext != null);
            Contract.Requires(filterContext.HttpContext != null);
            Contract.Requires(filterContext.HttpContext.Request != null);
            Contract.Requires(filterContext.RouteData != null);
            Contract.Requires(filterContext.Controller != null);
            Contract.Requires(settings != null);

            var model = new FacebookAuthorizeInfo(
                GetLoginUrl(settings, filterContext.HttpContext, null),
                Perms,
                filterContext.HttpContext.Request.QueryString.AllKeys.Contains("error_reason"),
                filterContext.RouteData.Values);

            var viewResult = new ViewResult
            {
                MasterName = Master,
                ViewName   = View,
                ViewData   = new ViewDataDictionary <FacebookAuthorizeInfo>(model),
                TempData   = filterContext.Controller.TempData
            };

            filterContext.Result = viewResult;
        }
Ejemplo n.º 3
0
        protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext, IFacebookApplication settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            var model = new FacebookAuthorizeInfo(
                GetLoginUrl(settings, filterContext.HttpContext, null),
                Permissions,
                filterContext.HttpContext.Request.QueryString.AllKeys.Contains("error_reason"),
                filterContext.RouteData.Values);

            var viewResult = new ViewResult
            {
                MasterName = Master,
                ViewName   = View,
                ViewData   = new ViewDataDictionary <FacebookAuthorizeInfo>(model),
                TempData   = filterContext.Controller.TempData
            };

            filterContext.Result = viewResult;
        }