0

I have Action Filters which gets executed before every action method. In the first filter OnActionExecuting(ActionExecutingContext filterContext) the filterContext is having the wrong data. So I need to know from where the ActionExecutingContext object gets populated. I have looked into the MSDN link. but the one line explanation is not clear to me.

EDIT 1: code to redirect

return Redirect("/SUser/Content/Collection/" + ID);

before going to the Content Controllers Collection action method, following filters method get executed.

public override void OnActionExecuting(ActionExecutingContext filterContext){}

the parameter filterContext should contain the URL "/SUser/Content/Collection/" but instead of that it contains a different URL and because of that it is getting redirected to the wrong action method.I want know How and Where the ActionExecutingContext class object gets populated so that if allowed I will set the correct URL.

TolerantCoder
  • 53
  • 1
  • 5
  • please post what incorrect data you are getting..its impossible to guess from what you wrote... – SamGhatak Feb 25 '16 at 12:28
  • @SamGhatak I am Redirecting to from one controller to other controlllers action method. before the control goes to the target controller action method filter method `OnActionExecuting(ActionExecutingContext filterContext)` gets executed. and the `URL` in `filterContext` object is not the one I am passing from the source controller. – TolerantCoder Feb 25 '16 at 12:35
  • Sorry, it would be best if you put the code of the filter here.. – SamGhatak Feb 25 '16 at 12:44
  • How are you accessing the URL in filterContext? – SamGhatak Feb 25 '16 at 12:55
  • @SamGhatak Added code. – TolerantCoder Feb 26 '16 at 11:51

0 Answers0