ASP.NET Invalid character in a Base-64 string

半腔热情 提交于 2019-12-03 16:23:22
IrishChieftain

It might be how things are configured. Take a look at this:

http://groups.google.com/group/elmah/browse_thread/thread/ec9c4bdddaa1a9e/9108b48d3def87db?lnk=gst&q=viewstate+elmah#9108b48d3def87db

UPDATE

Try and identify where it is occurring. There may be several potential causes:

"Invalid Character in Base-64 String" using ASP.NET and C#

asp.net Invalid character in a Base-64 string

At the end of the day, if as you say, it is not causing any problem in production, then you can filter out these errors. Try setting EnableViewStateMac to false?

Brian Rogers

In my experience, this error tends to be cause by the user double-clicking on a button that triggers a postback. The second postback request cancels the first. The viewstate of the first request is only partially submitted, so it is invalid, but the error can't be sent to the browser because it has disconnected, which triggers the top-level error. This may be a bigger problem if the user doing something twice causes trouble. Otherwise, these errors can simply be filtered. Here's a good example of filtering out similar errors in ELMAH: https://stackoverflow.com/a/2549509/267448

If you're using ASP.NET WebForms, here's some code to disable the triggering control during postback: http://disturbedbuddha.wordpress.com/2007/12/10/disabling-a-trigger-control-during-asynchronous-postback/

Beware that if you disable an HTML <input type="submit"> button, it is excluded from your form variables, so your server-side Click event doesn't fire. Changing it to an <input type="button"> fixes that. In WebForms, that would be <asp:Button UseSubmitBehavior="False" />.

The above works with WebForms AJAX pages, but here's also a little bit of jQuery I came up with for other pages.

$(function () {
    $("a[href^='javascript']").click(function (event) {
        if (event.target.disabled)
            return false;
        event.target.disabled = true;
        setTimeout(function () {event.target.disabled = false;}, 250);
    });
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!