How to get sign-in URL in Adxstudio portal web app for external ID provider

Recently I have been looking at customising the Adxstudio portal web app (the MVC app). One of the things I needed to do was to create a link that would take users to the login page for the portal. Our portal is configured to use ADFS as the external ID provider, and the link needs to take users straight to the ADFS login page.

The Adxstudio framework code has an extension method on the UrlHelper class that allows you to easily do this, namely SignInUrl(). This method accepts an optional returnUrl parameter, which is the URL that users will be redirected to once successfully authenticated.

From the C# code-behind, you can instantiate an instance of UrlHelper and invoke the extension method like so:

lnkLogin.NavigateUrl = new UrlHelper(Request.RequestContext).SignInUrl("/private/dashboard");

From the ASPX markup, you can use the Url property of the page/user-control to invoke the method:

<a href="<%: Url.SignInUrl() %>">Sign in</a>

 

The method uses the authentication settings configured for the website to return the correct sign-in URL for the external ID provider.

Important: This method returns the sign-in URL of the external ID provider only if that provider is configured to be used as the only provider for the website.

You can configure this using the Authentication/Registration/LoginButtonAuthenticationType Site Settings in CRM configuration. For ADFS for example, set the value of this Site Setting to be the same as the Authentication/Registration/LoginButtonAuthenticationType Site Setting.

For more information on these two Site Settings, please see https://docs.microsoft.com/en-us/dynamics365/customer-engagement/portals/set-authentication-identity and https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/portal-authentication/asp.net-identity-authentication/ws-federation-provider-settings/

 

Advertisements

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in Adxstudio, CRM Portal. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s