1

I have custom AuthorizeAttribute as here : Handling session timeout in ajax calls It works great. But LogOn Action of the Account Controller has returnURL parameter in ASP.NET MVC. After LogON it returns to last page(returnURL). And now i want to to return data as below if :

if (filterContext.HttpContext.Request.IsAjaxRequest())
            {
                if (!filterContext.HttpContext.User.Identity.IsAuthenticated)
                {

    filterContext.Result = new JsonResult
                        {
                            Data = new
                            {
                                // put whatever data you want which will be sent    
                                // to the client    
                                message = "/Account/LogON/?returnUrl=" + filterContext.ActionDescriptor.ControllerDescriptor.ControllerName + "/" + filterContext.ActionDescriptor.ActionName
                            },
                            JsonRequestBehavior = JsonRequestBehavior.AllowGet
                        }; 
                 }
           }

But you can see here that it returns ActionName which called by ajax.But I want to return base ActionName. Please advice me. I have some ideas as hidden value or get ActionName from windows.location with javascript. but i think it is not good idea. Ask question if you will not understand my question

Community
  • 1
  • 1
AEMLoviji
  • 3,217
  • 9
  • 37
  • 61
  • 1
    What do you mean under base action name? – archil Apr 06 '11 at 07:23
  • lets say i am in List Action of Products Controller. And a call GetAjax Action of Products Controller with ajax. And i want to receive /Products/List not /Products/GetAjax – AEMLoviji Apr 06 '11 at 07:50

1 Answers1

1

You could use HttpRequest.UrlReferrer Property

archil
  • 39,013
  • 7
  • 65
  • 82