browse by category or date

Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation=”true”/> in configuration or <%@ Page EnableEventValidation=”true” %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Event validation is a security measure by ASP.NET to prevent Injection-Attack (i.e. other page post their result to your ASPX page). Turning this option off through the web.config or inside the <%@ Page .. %> tag will guarantee you will never receive above error, but your security might be compromised.

But if your page still producing above error, say when you click a button, or select the value of a server dropdownlist control, these conditions might be applicable to your ASPX page:

  1. You have another <form /> tag inside your main Form tag
  2. Your AJAX/Javascript code changed the value of a server control
  3. You type tags that resemble HTML tags inside a textbox/text-area

What I have today was number 1. I found a <form /> tag inside a < asp:Content .. /> tag. The error came out when I convert my ASP.NET Website project into .NET Web Application Project. So its quite surprising that page never throw any Event validation error during its tenure as Website project. Another possibility is the <form /> was generated by Visual Studio when i convert the project. I’ll do some trial and error more tomorrow…

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant:

Search for this at Google:

Invest $1000000 for Movie

And compare the result from Yahoo:

Invest $1000000 for Movie

Surprisingly, my blog is no.2 at Yahoo’s result, but nowhere in Google’s result. I did even try to search within result in Google by adding word ‘Sodeve’, but nada, zilch, nil .. nothing. 😀

I know.. I know.. I should be grateful to Yahoo for putting me in the 2nd spot .. but for the sake of fairness to the poor soul who is trying to get an investor to invest $1 Million in his/her movie project, please use Google next time 😀

As for Yahoo, this means that there are a lot of rooms for improvements in its searching algorithms 😀 (in case the result changed, I put the screenshot HERE)

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant:

I notice from my traffic log that there was someone bumping to this blog searching for ‘C# Regex Word Count’. Since I never create such tutorial, so here you go.

The basic rule of a word would be it doesn’t contain any whitespaces (spaces, tabs, or newlines). So the easiest Regex would be:

[^\ ^\t^\n]+

Now to implement it using C#, It would be as follows:

      public int WordCount(String input)
      {
         int result = 0;
         try
         {
            Regex rgx = new Regex(@"[^\\ ^\\t^\\n]+");
            MatchCollection mcMatches = rgx.Matches(input);
            result = mcMatches.Count;            
         }
         catch (Exception ex)
         {
         }
         return result;
      }

An improvement would be putting the Regex creation out of the function, this way we will not re-created the Regex everytime the function is called.

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant: