Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8601227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:47:39+00:00 2026-06-12T01:47:39+00:00

I am making an MVC3 site using ServiceStacks authentication mechanism. When I add the

  • 0

I am making an MVC3 site using ServiceStacks authentication mechanism. When I add the AuthenticateAttribute to a controller, I get a null reference exception:

System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=ServiceStack.FluentValidation.Mvc3
StackTrace:
at ServiceStack.Mvc.ExecuteServiceStackFiltersAttribute.OnActionExecuting(ActionExecutingContext  filterContext) in  C:\src\ServiceStack\src\ServiceStack.FluentValidation.Mvc3\Mvc\ExecuteServiceStackFiltersAttribute.cs:line 21
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)

I can see in github that pull request #267 seems to make some null ref check exactly where my code currently throws. I have another project where authentication works, but the new failing code is running on a newer version of ServiceStack and I can’t see what the difference is, so any ideas about what could cause this exception for new versions of service stack (v. 3.9.18)

Here is my configuration code:

Plugins.Add(new AuthFeature(
                        () => new AuthUserSession(), // Here a custom IAuthSession implementation could be used instead of UserSession.
                        // Allow authentication by using cookies set when authenticating with username/password credentials posted to the /auth/credentials service.
                        new IAuthProvider[]{ new CredentialsAuthProvider() }
                        )
            );
 //Enable Funq IOC in MVC controllers.
 ControllerBuilder.Current.SetControllerFactory(new FunqControllerFactory(container));


IUserAuthRepository userRepository = new OrmLiteAuthRepository(dbFactory);
container.Register(userRepository);
container.Register<ICacheClient>(new MemoryCacheClient());

        // Initialise Registration feature, providing the /register route.
        Plugins.Add(new RegistrationFeature());

And my Controller base class:

public abstract class ControllerBase : ServiceStackController<AuthUserSession> {
    public IDbConnectionFactory Db { get; set; }
    public ILog Log { get; set; }
    //Common extension point for all controllers. Inherits from ServiceStack to take advantage of SS powerpack + auth.
    public override string LoginRedirectUrl {
        get {
            return "/Auth/Login?redirect={0}";
        }
    }

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:47:40+00:00Added an answer on June 12, 2026 at 1:47 am

    I’ve updated the ServiceStack.Mvc NuGet package that resolved a null reference exception in (v3.9.18+). Try updating and see if that resolves it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using asp.net mvc3. I am making a bitmap using text by system.drawing.
I'm busy making a CMS using MVC3. I want to test the current build
I am using the built in Forms authentication in an MVC3 application. The issue
I am an application development intern. I'm making an application using ASP.NET MVC3 that
I am using C# ASP MVC3 and I am making a generated menu with
Is it possible to add an [Authorize(Roles=Admin)] (as an example) to an MVC3 Controller
I've built a notification system for an ASP.NET MVC3 site I've been working on
I'm using ASP.NET MVC3 with Razor and C#. I am making a form builder
I am making the front end of a asp.net mvc3 web application. A controller
I am making the Quiz Engine in Asp.Net MVC3. In my data base I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.