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开发者_StackOverflow中文版 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
You could use HttpRequest.UrlReferrer Property
精彩评论