Created
June 27, 2012 23:47
-
-
Save glikoz/3007664 to your computer and use it in GitHub Desktop.
Base Controller for ServiceStack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
using ServiceStack.Mvc; | |
using ServiceStack.ServiceInterface.Auth; | |
using ServiceStack.ServiceInterface; | |
using ServiceStack.ServiceHost; | |
namespace xxx.Website.Controllers | |
{ | |
//[Authorize] | |
//[Authenticate] | |
public abstract class BaseController : ServiceStackController<CustomUserSession> | |
{ | |
public AuthService AuthService | |
{ | |
get | |
{ | |
var authService = ServiceStack.WebHost.Endpoints.AppHostBase.Instance.Container.Resolve<AuthService>(); | |
authService.RequestContext = new HttpRequestContext( | |
System.Web.HttpContext.Current.Request.ToRequest(), | |
System.Web.HttpContext.Current.Response.ToResponse() | |
, null); | |
return authService; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment