ASP.NET Invalid character in Base-64 string

I recently implemented ELMAH on my site, and I noticed that we often get the error "Invalid character in Base-64 string." I never started it myself, and none of our users complained about it, so I don’t know what is happening. From the little that I could find, it seems that it can get too big or become corrupt. Does anyone know what causes this and how to prevent it? This is what I consider the appropriate lines in YSOD.

[FormatException: Invalid character in a Base-64 string.] [ViewStateException: Invalid viewstate. [HttpException (0x80004005): The client disconnected.] 

Is there anything I can do with these errors, or should I just filter them in ELMAH?

+4
source share
2 answers

Perhaps this is how the settings 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 to determine where it occurs. There may be several potential reasons:

"Invalid character in Base-64 string" using ASP.NET and C #

asp.net Invalid character in Base-64 string

At the end of the day, if, as you say, this does not cause any production problems, you can filter out these errors. Try setting EnableViewStateMac to false?

+2
source

In my experience, this error usually causes a double click on the button on the button that causes the postback. The second postback request cancels the first. Viewing the status of the first request is presented only partially, therefore it is invalid, but the error cannot be sent to the browser because it is disabled, which causes a top-level error. This can be a big problem if a user doing something twice causes problems. Otherwise, these errors can simply be filtered. Here is a good example of filtering similar errors in ELMAH: fooobar.com/questions/571039 / ...

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

Remember that if you disable HTML <input type = "submit">, it is excluded from your form variables, so your server side Click event does not fire. Changing it to <input type = "button"> fixes this. In WebForms, this will be <asp: Button UseSubmitBehavior = "False" />.

The above works with AJAX WebForms pages, but there is also a bit of jQuery that 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); }); }); 
+4
source

Source: https://habr.com/ru/post/1337216/


All Articles