Please note that this topic refers to SAML for ASP.NET rather than SAML for ASP.NET Core. A better approach when using SAML for ASP.NET Core is to hook into the OnAuthnRequestCreated event and set the AttributeConsumingServiceIndex property as shown in the following example.
// Set the AttributeConsumingServiceIndex in the authn request.
_samlServiceProvider.Events.OnAuthnRequestCreated += (httpContext, authnRequest) =>
authnRequest.AssertionConsumerServiceIndex = 1;
// Initiate single sign-on to the identity provider (SP-initiated SSO).
var partnerName = _configuration["PartnerName"];