Sitecore Workbox Exception: Object of type 'System.Int32' cannot be converted to type 'System.Web.Security.Cryptography.Purpose'.

Update:

Support supplied me with a fix. For anyone else having these issues:

Please try to use the following solution:

Put the attached 'Sitecore.Support.399133.dll' file to the 'bin' folder (Website\bin).

Put the attached 'Workbox.xml' file to the 'Override' folder (Website\sitecore\shell\Override)

Please note that this workaround was not deeply tested and we recommend you backup your solution before applying any changes.

Download here

Original post:

This is not a new issue however today I opened the Sitecore Workbox and boom the exception above.

I've seen this exception before when opening Sitecore and the Login.RememberLastLoggedInUserName setting fixed the issue see: John West Fix

However, this does not fix the issue with the workbox. It seems to affect various versions Sitecore 6.5 (we are on 111230) and despite my best Googling could not find an answer. I certainly did not want to uninstall .net 4.5!

I managed to find a fix to this by looking at the stack trace and decompiling Sitecore.Shell.Applications.Workbox.WorkboxForm which seemed to be the root of the problem.

This calls FeedUrlOptions.ToString() which in turn then produces the error.

The offending code lives within:

if (this.UseUrlAuthentication)
{
    Assert.IsNotNullOrEmpty(this.Username, "Username is required for URL authentication");
    this.EnsureSalt();
    urlString["sc_rssu"] = MachineKeyEncryption.Encode(this.Username);
    urlString["sc_rssh"] = this.Hash();
}

..So to fix, simply create your own implementation of WorkboxForm overriding DisplayWorkflow method.

The only code you need to change is to set UseUrlAuthentication to false.

FeedUrlOptions feedUrlOptions = new FeedUrlOptions("/sitecore/shell/~/feed/workflow.aspx")
{
    UseUrlAuthentication = false
};

Open Sitecore\shell\Applications\Workbox\Workbox.xml and update the <CodeBeside Type= to your new class.

You will notice that you get a little further. You need to also override DisplayStates doing the same thing.

Here's a link to the full code should you need it.

The full implications of setting Use UrlAuthentication to false? - I have an open ticket with support asking this very question and will update when I know.

Dave Leigh

Web, and long time Sitecore developer based in Bristol, UK, working at Valtech - valtech.co.uk - @valtech.
I occasionally do other things too.