Jay S
Jay S

Reputation: 7994

Sitecore Workbox throws Cryptography.Purpose exception with .NET 4.5 installed

After installing .NET 4.5, any users accessing the Workbox now receive an exception:

Object of type 'System.Int32' cannot be converted to type 'System.Web.Security.Cryptography.Purpose'.

After some basic google searching, it appears as if this issue used to happen on login, and was resolved in 6.5 for the login. I have no issues logging into Sitecore. So far I'm only seeing this issue in the workflow box.

Before .NET 4.5 was installed, we were running on .NET 4.0 without any issues.

Has anybody found a workaround to get the Workbox running with .NET 4.5 installed?

NOTE: I'm currently using Sitecore 6.5 Update 5

Full Stack Trace:

[ArgumentException: Object of type 'System.Int32' cannot be converted to type 'System.Web.Security.Cryptography.Purpose'.] System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) +185 System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) +122 System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +206 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +126 Sitecore.SecurityModel.Cryptography.CookieProtectionHelperWrapper.Encode(CookieProtection cookieProtection, Byte[] buf, Int32 count) +175 Sitecore.Shell.Feeds.FeedUrlOptions.ToString() +192 Sitecore.Shell.Applications.Workbox.WorkboxForm.DisplayWorkflow(IWorkflow workflow) +496 Sitecore.Shell.Applications.Workbox.WorkboxForm.OnLoad(EventArgs e) +545

[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +76 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +193 System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35 Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e) +337 System.Web.UI.Control.LoadRecursive() +116 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2910

UPDATE: We already have the web.config entry altered, which is why Login works correctly:

<setting name=”Login.RememberLastLoggedInUserName” value=”false” />

Upvotes: 0

Views: 2295

Answers (6)

Flapper
Flapper

Reputation: 2889

As an aside to this, I encountered this issue but only upon launching the workbox. This link http://www.daveleigh.co.uk/sitecore-workbox-object-of-type-system-int32-cannot-be-converted-to-type-system-web-security-cryptography-purpose/ provided a sitecore provided fix which resolved my issue.

Upvotes: 0

Shriroop
Shriroop

Reputation: 1182

I know this has been resolved but thought would still contribute as I came across this error and resolved in a different way.

Check out the following links:

  1. http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2012/09/Object-of-type-System-Int32-cannot-be-converted-to-type-System-Web-Security-Cryptography-Purpose.aspx

  2. Read the comment by Kevin Obee at the bottom of http://kamranicus.com/Blog/Posts/45/sitecore-and-net-framework-45

  3. http://truncatedcodr.wordpress.com/2012/06/20/fix-sitecore-and-net-framework-4-5/

Reading this resolved my issue and Sitecore works fine.

Upvotes: 0

pbering
pbering

Reputation: 943

If you are running earlier versions than 6.5 update 5 you need to override the workbox methods:

DisplayStates
DisplayWorkflow

And set the feed options like so:

var feedUrlOptions = new FeedUrlOptions("/sitecore/shell/~/feed/workflowstate.aspx")
   {
      // HACK: This is to make workbox work on machines with .NET 4.5 installed
      UseUrlAuthentication = false
   };

Upvotes: 1

Jay S
Jay S

Reputation: 7994

Thanks to both Mark and Stephen for their help, unfortunately neither options applied in this particular scenario. (Upvoted by me, however, as they may help somebody else running into this problem).

With some further digging, it appeared that what had happened in this scenario was that some of the Sitecore 6.5 Update 5 DLLs had not been deployed, and were instead on version 6.5 Update 4.

After redeploying the correct Update 5 DLLs (and keeping the web.config change we had previously) the site is now operating on .NET 4.5 and the workbox now loads without any exceptions being thrown.

Upvotes: 2

Mark Ursino
Mark Ursino

Reputation: 31435

This blog post seems to have a solution, which involves uninstalling .NET 4.5 and reinstalling 4.0

Upvotes: 1

Stephen Pope
Stephen Pope

Reputation: 3551

As a work around just change this setting in your web.config..

<setting name=”Login.RememberLastLoggedInUserName” value=”false” />

Upvotes: 2

Related Questions