mercredi 18 novembre 2015

Issue in Redirecting on Action Filter onActionExecuting

I have an issue in redirecting to the external URL Requirement I want to redirect to an external URL whenever the session is expired .... I have a separate class in which I override the definition of onActionExecuting Action Here is my Code ...

public class SessionExpireAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
       // var redirectUrl = "http://www.google.com";
        var isAjaxRequest = filterContext.HttpContext.Request.IsAjaxRequest();

        if (isAjaxRequest)
        {
            filterContext.Result = new RedirectResult("http://www.google.com");
            return;
        }
        base.OnActionExecuting(filterContext);

    }
}

I Have try almost all the solution that I could find on Stack Over Flow but my problem is not still solved.

Is there is any issue related to pipeline execution of controller filters if so kindly guide me ...

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire