CreateDynamicContent method throws "not a valid Base-64 string" exception for state

Vote:
 

I'm using DynamicContentFactory.Instance.CreateDynamicContent() to create instances of dynamic content plug-ins that are within content areas so I can read their property values. Everything works as expected with some of the dynamic content plug-ins, I can create instances of them, but others fail with the following error.

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters.

The difference between the dynamic contents which work and the ones that don't is the way they have been written. The ones that work have been created by writing classes with the IDynamicContent interface, while the ones that don't work were created using the user control method.

The dynamic content plug-ins work as they should - except an intermittent problem with Mirroring, but that's another story.

I would change the user control ones to use the IDynamicContent method instead and then load in the user control manually, but it's not something I can do right now so I'm hoping for workaround.

The state string which causes an exception is formatted differently to the ones that work. There seems to be & separators. I'm not sure how EPiServer is generating this state string.

QasdfdsaFHJFdhsdHIAZQA=&QgBlasdfsadfasIAZAA=|UwBoAG8AadsdgsaddfsadfssAasdfB5AA==&

The state string for the custom dynamic contents, which I'm creating and converting the state to Base64 myself in the plug-in, looks something like the following (but I've trimmed it) and works correctly when passed to the CreateDynamicContent method.

PGlasdsa7dsa7dsa6iYWwvZWxlcGhhbnasdsahZ2VVcmw+PHRleHQ+PC9kaXNwbGF5SW5saW5lPg==

I might be barking up the wrong tree. If this makes some sense to you then I'd appreciate some help.

Cheers

 

#63127
Nov 09, 2012 14:01
Ted
Vote:
 

I've seen this before, but I cannot say for sure what caused it. :(

Which version are you running? Have you upgraded from R1 to R2 since the dynamic content was added? Does it work if you remove and re-add the dynamic content? Does it only happen in one environment, such as production, but not in another?

(If you cannot reach edit mode because of the exception, disable the dynamic content temporarily.)

#63137
Nov 10, 2012 10:15
Vote:
 

I'm running 6R2 latest update (502?). Also it wan't upgraded, it's a 'new' site.

I've removed and re-inserted the dynamic contents and it didn't help. I went through a number of DCs just to make sure it was down to the way they had been created and not just a coincidence - all using the user control implementation didn't work.

I was able to replicate the issue on another test server and my local machine.

Hopefully I will get a chance to investigate it further later this week and experiment.

Thanks anyway, Ted. If you suddenly remember be sure to let me know! :)

#63143
Nov 11, 2012 21:49
Vote:
 

Did you ever figure out what caused this?
I have the same problem =/
The "only" thing is that we have moved the database from SQL 2005 to SQL 2012 the code is untouched.

/Jimmy

#71007
May 07, 2013 10:50
Vote:
 

Hi, did any of you find any solution to this?

I have the same problem now. We have not upgraded the site or SQL server, but we are trying to move the site to another hosting server.

#74916
Sep 11, 2013 14:53
Vote:
 

I heard something that feels a bit strange but I have not verified it, is the SiteId in episerver.config the same on both machines?

Most of the time I saw this when backstaging from production environment to development environment

#74921
Sep 11, 2013 15:39
Vote:
 

Yes the SiteId is the same in both machines. 

#74923
Sep 11, 2013 15:45
Vote:
 

Do you have the same versions on EPiServer 6 R2 on your environments (including all patches released)?

#74924
Sep 11, 2013 15:48
Vote:
 

Yes we do, version 6.1.379 in both machines. 

#74927
Sep 11, 2013 15:58
Vote:
 

Uhm I'll take that back. On the new server the Episerver.dll in C:\Program Files (x86)\EPiServer\CMS\6.1.379.0\bin are not the of the same version.

 

The old machine has 6.1.379.502 and the new has 6.2.379.1. I will update and update the thread.

#74929
Edited, Sep 11, 2013 16:06
Vote:
 

Wouldn't surprise me if that solves the problem.

The latest patches released for EPiServer 6 is quite tricky.

#74931
Sep 11, 2013 16:07
Vote:
 

As expected it worked. Thank you!

 

Found out that the error was in the Episerver.dll. As written above EPiServer have changed the method to add Dynamic Content to the database and the older versions do not support the '&' signs.

#74958
Sep 12, 2013 14:32
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.