Paolo ponzano - 368 - Dec 19, 2014

Hi Demis,
I’ve an ASP.Net MVC 5 web application using ServiceStack.Mvc. I’m using the CredentialsAuthProvider (with OrmLiteCacheClient and OrmLiteAuthRepository).
In the db UserAuth table (SQL Server in my case) there is a user with “ACME” as the value for the field “Company”. 
What I would like to do is to have this value when I read the UserSession in my MVC Controller.

Can you help me, please?

Kebin Maharjan:

Hi Paolo,
If I understand correctly, you want to populate custom field in the UserSession? If so you’d want to subclass AuthUserSession as mentioned here: https://github.com/ServiceStack/ServiceStack/wiki/Sessions#using-typed-sessions-in-servicestack

Then override OnAuthenticated, populate the custom data in your custom typed session.