First of all I have already look at the similar solution to the following ones:
ASP.NET MVC : Handle Session Expire Using Custom Attribute
Redirect to specific page after session expires (MVC4)
But I need a smart solution regarding to this problem by just typing a code on Global.asax etc. and not requiring an extra implementation on every Cntroller. Is it possible? If not, what is the best approach for redirecting to login page after session is timeout in ASP.NET MVC?
You can handle session timeouts in
Global.asaxfromSession_Endmethod. Just FYI, It has some cons: it will be called not necessarily right after the timeout and it works if your session is in runtime memory. Try it, maybe it will be enough for your case.Another way to do it can be using SessionStateModule or creation custom HTTP module paired with some of global events which can be used for session control.