In the Sitecore doc Configuring Federated Authentication there are instructions to generate the URL links to initiate Federated Auth -- the lines are:

using Sitecore.Pipelines.GetSignInUrlInfo;
var args = new GetSignInUrlInfoArgs(site: "website", returnUrl: "/");
GetSignInUrlInfoPipeline.Run(corePipelineManager, args); 

How do I get an instance of the corePipelineManager in order to pass to the GetSignInUrlInfoPipeline? I tried using the

var corePipelineManager = Sitecore.DependencyInjection.ServiceLocator.ServiceProvider.GetService<BaseCorePipelineManager>();

But am getting an error below:

CS1928: 'System.IServiceProvider' does not contain a definition for 'GetService' and the best extension method overload 'System.Web.Mvc.DependencyResolverExtensions.GetService(System.Web.Mvc.IDependencyResolver)' has some invalid arguments

  • 1
    Have you tried var corePipelineManager = Sitecore.DependencyInjection.ServiceLocator.ServiceProvider.GetService(typeof(BaseCorePipelineManager));?
    – Marek Musielak
    Feb 23, 2018 at 18:52
  • Marek -- you're correct - I was trying to put it directly into the razor but when I pulled it into the codebehind using your line it started working.
    – Watson
    Feb 26, 2018 at 16:04

1 Answer 1


Your code is correct. Just add Microsoft.Extensions.DependencyInjectionnamespace. It contains ServiceProviderServiceExtensions extension class that adds generic methods to the IServiceProvider interface.

At the same time, I would recommend you to use a constructor injection. It is supported in Sitecore and it lets you avoid a ServiceLocator anti-pattern.

  • Wait do you get extra points for answering my questions on your blog AND stack over flow :)
    – Watson
    Feb 26, 2018 at 16:03
  • @Watson ;) That blog is not mine. I'm just trying to monitor issues for the features I've done :) Feb 27, 2018 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.