I'm currently building an mvc3 w/ servicestack web app. I'm using servicestack credentials authentification and using servicestack sessions.
I'm already aware that I can access the session in the view by retrieving and setting it in the ViewBag this way:
public partial class HomeController : ControllerBase {
public virtual ActionResult Index() {
ViewBag.UserSession = base.UserSession;
return View();
}
}
I really don't want to repeat this piece of code in each of my methods and I'am looking for a generic way of accessing the session in my views, any ideas?