Skip to content

Instantly share code, notes, and snippets.

@glikoz
Created June 27, 2012 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glikoz/3007664 to your computer and use it in GitHub Desktop.
Save glikoz/3007664 to your computer and use it in GitHub Desktop.
Base Controller for ServiceStack
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