asp.net mvc - ViewBag empty in ActionFilter OnActionExecuted -
i have requirement log user's journey through asp.net mvc application. using global actionfilter , log4net. need able read values (specifically viewbag.title
) viewbag have been set in view. @ moment viewbag coming empty.
public class useractivityfilter : iactionfilter { public void onactionexecuted(actionexecutedcontext filtercontext) { var properties = new dictionary<string, string>(); if (filtercontext.result viewresult) { var action = filtercontext.result viewresult; properties.add("page.title", action.viewbag.title); } // log4net stuff goes here } }
my views of following form:
@model foo.barviewmodel @{ viewbag.title = "application: " + model.name; } @html.displayformodel()
is possible read values in viewbag set in view?
Comments
Post a Comment