TinyMCE and Viewstate verification failed. Reason: Viewstate was invalid
-
22-07-2019 - |
Question
Visual Studio 2008 .NET 3.5
I'm using the built in web server to test, and everything works fine. My TinyMCE code is the following:
<!-- TinyMCE -->
<script type="text/javascript" src="/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode: "textareas",
theme: "advanced",
plugins: "paste",
relative_urls: false,
remove_script_host: false,
// Theme options
theme_advanced_buttons1: "bold,italic,link,unlink,image",
theme_advanced_buttons2: "",
theme_advanced_buttons3: "",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: false,
// Example word content CSS (should be your site CSS) this one removes paragraph margins
content_css: "includes/tinyMCEword.css",
// Drop lists for link/image/media/template dialogs
external_image_list_url: "lists/image_list.js"
});
</script>
<!-- /TinyMCE -->
Now, the issue I'm having, is on any pages that I have this code, I'll intermittently get ViewState errors, namely:
Event code: 4009 Event message: Viewstate verification failed. Reason: Viewstate was invalid.
I noticed when this happens, on top of my page, it looks like I have ViewState data (encrypted) being outputted. Only on pages with TinyMCE. I have no idea why it's occuring. Everything works perfectly fine locally, but when deployed to a Win2K3 server (IIS6), I'm getting this issue.
I really am lost. Any ideas fellas?
Thanks, -Steve
Solution
I'm having the exact same problem with my site. Part of the viewstate data is visible on top of page. Works fine locally. Even my javascript code is very similar to yours.
Only happens on webkit browsers (safari/chrome).
It seems that tinyMCE places a .js file (tiny_mce/themes/advanced/langs/en.js) randomly inside the viewstate, thus corrupting it.
I tried different versions of tinyMCE, changed the javascript code. Nothing worked so far.
Anyone have any ideas?
OTHER TIPS
Doesn't look like you have your init call in the head tag but a coworker of mine just ran into a similar issue that was a result of making the call to the init in the head. After moving the call out to its own tag everything worked fine.
Hopefully this at least helps someone!