Like many of my ServiceStack questions, I'm sure this will be pretty easy.
I have an asp.net MCC4 application in which I am using ServiceStack for authentication. Because the cookies generated by the ServiceStack client aren't shared, I've followed the response in questions like this to resolve the issue:
ServiceStack Session always null in MVC Controller
In my client I have this snippet of code:
var authService = AppHostBase.Resolve<AuthService>();
authService.RequestContext = System.Web.HttpContext.Current.ToRequestContext();
var AuthResponse = authService.Authenticate(new Auth
{
provider = "credentials",
UserName = user.user_id,
Password = user.password,
RememberMe = true
});
if (AuthResponse.SessionId != null)
{
Session["IsAuthenticated"] = true;
Session["UserID"] = AuthResponse.UserName;
FormsAuthentication.SetAuthCookie(user.user_id, true);
return Redirect("/home");
}
else
{
Session["IsAuthenticated"] = false;
}
When I try and run the application, I get the error:
"AppHostBase is not initialized."
What might I be missing? I apologize in advance for my inexperience with ASP.net in general.
Update
I should point out that this is only an MCV4 client application that will be using a ServiceStack API that is part of a different project.
Update 2
I think this might be a part of my not perfect understanding of SS and how it would fit into a web application such as this. I believe what I may really be after is understanding just how this ASP.net client can hook back up with an existing session on the ServiceStack API server.