Zoran Knezevic - 161 - Dec 30, 2013

+Demis Bellot Hi Demis, I posted this on stack overflow and have not gotten any replies.  Could you take a look and let me know if that sounds like a bug or if there is something that I am doing wrong?  http://stackoverflow.com/questions/20642898/servicestack-sessionascustomusersession-does-not-return-data

Hi Zoran, it would help if I could see an example self-hosting app or a failing test I could verify the behavior of as I can’t tell if it’s properly registered, have you registered the CustomUserSession when registering the AuthFeature? like in: https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.AuthWeb.Tests/AppHost.cs#L79

Zoran Knezevic:

I can try to put together an sample application but that would take me some time.  However, I have updated the StackOverflow question with the AppHost Config info.  I think it is configured properly because I got the session to work, but was just not able to use the SessionAs<T> method to access the data.  Instead I use var customUserSession = this.GetSession() as CustomUserSession; 

Does it work differently if you just registered a MemoryCacheClient? i.e. instead of using a Redis cache?

Zoran Knezevic:

I commented out the Redis Config.  I then registered the MemoryCacheClient.  container.Register<ICacheClient>(new MemoryCacheClient());  Had the same result.

var x = SessionAs<CustomUserSession>();  // x = is not null, but does not contain any values

var y = this.GetSession() as CustomUserSession;  //y = is not null, and it does contain the values that were set in the cache

ok great, then there must be a problem with how it’s being used.
I’m assuming you have cookies enabled in the browser?