Exemplo n.º 1
0
        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (UrlManager.IsReturning)
            {
                UrlManager.IsReturning = false;
                return;
            }

            string requestUrl = filterContext.HttpContext.Request.UrlReferrer?.PathAndQuery;

            if (requestUrl.Where(s => s == '/').Count() == 1 || requestUrl.IndexOf("Index") != -1) //check if url is at "Index"
            {
                UrlManager.ClearStack();
            }

            if (requestUrl.IndexOf("Edit") == -1 && requestUrl.IndexOf("Create") == -1)
            {
                UrlManager.AddUrl(requestUrl);
            }
        }
Exemplo n.º 2
0
        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (UrlManager.IsReturning)
            {
                UrlManager.IsReturning = false;
                return;
            }

            string requestUrl = filterContext.HttpContext.Request.UrlReferrer?.PathAndQuery;

            if (UrlManager.IsAtIndexView(requestUrl))
            {
                UrlManager.ClearStack();
            }

            if (!UrlManager.IsLastView(requestUrl))
            {
                UrlManager.AddUrl(requestUrl);
            }
        }