Missing configuration
for the requesting relying party

Jan 12

After upgrading to Sitefinity 8.2 my login widget stopped working with a return url query string. Checking my other sites they too had the same issue after upgrading.

I got this error on a site recently and was a bit perplexed as to what the issue was. I soon found out that it was an issue after upgrading my site to 8.2 and it was an issue on all my sites.

Cause

The issue is with the Sitefinity Login Widget and the use of a return URL query string. It appears that with 8.2 the Claims Authentication process gets mighty confused and throws this error.

My Set Up

For sites that have a Client Access section I create a role in Sitefinity and then a Group page and alter the permissions to only allow that role access to that group page and any pages under it.

If someone tries to access one of those pages and they are not authorised I then redirect them to my sign in page and append a return url so that after they sign on they go back to the page they were trying to access in the first place. The code is placed in the global file. Nice and simple.

protected void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args)
{
    EventHub.Subscribe<IUnauthorizedPageAccessEvent>(new Telerik.Sitefinity.Services.Events.SitefinityEventHandler<IUnauthorizedPageAccessEvent>(OnUnauthorizedAccess));
 
    if (args.CommandName == "Bootstrapped")
    {
 
    }
}
 
private void OnUnauthorizedAccess(IUnauthorizedPageAccessEvent unauthorizedEvent)
{
    String currentPage = HttpContext.Current.Request.Url.PathAndQuery;
    String loginPath = "/sign-in?ReturnUrl=";
 
    unauthorizedEvent.HttpContext.Response.Redirect(String.Concat(loginPath, currentPage));
}

Solution

Turns out the solution is not to use a relative url any more but a absolute one, (Thanks to Arno Peters on Google Plus for this info). To fix this I altered the method as below. I used the Request class so the code would work if I am developing on localhost or the code is on QA or production url's.

String loginPath = "/sign-in?ReturnUrl=" 
    + HttpContext.Current.Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.SafeUnescaped)

Note that this issue only happens with the Web Forms login widget not the MVC Feather Login widget.

Hopefully this helps someone else sort this problem out quickly.


Darrin Robertson - Sitefinity Developer

Thanks for reading and feel free to comment
Darrin Robertson


Leave a comment
Load more comments

Make a Comment

Please type the code above

comment-avatar