I am working with MVC 5.
I need to call a function before every page is loaded.
I did it in the _Layout.cshtml
view:
$(function () {
$('body').on('click', function (e) {
var valor = GetSession();
$('#hdnSessionTime').val(valor);
});
}
I save a value in a hidden field defined in the layout page, and every time the user click on every page, the function called GetSession
executes.
The problem is that it execute after @RenderBody()
and I need it before...
Is that possible?