473,657 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asp.net error in Firefox only when clicking button repeatedly

56 New Member
Hi all,

I created a test web application in asp.net. It works like a dream in IE but when it gets to Firefox I get an exception as follows

-----------------------------------------------------------------------------------------
"System.Argumen tException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventVali dation="true"/> in configuration or <%@ Page EnableEventVali dation="true" %> in a page."

Stack Trace:

[ArgumentExcepti on: Invalid postback or callback argument. Event validation is enabled using <pages enableEventVali dation="true"/> in configuration or <%@ Page EnableEventVali dation="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 ClientScriptMan ager.RegisterFo rEventValidatio n method in order to register the postback or callback data for validation.]
System.Web.UI.C lientScriptMana ger.ValidateEve nt(String uniqueId, String argument) +2127849
System.Web.UI.C ontrol.Validate Event(String uniqueID, String eventArgument) +106
System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument) +32
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) +7
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) +11
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5102
-----------------------------------------------------------------------------------------------------

I get this when I click a button repeatedly, say when a request is not yet completed. In simple english I click any button on the form before the form fully loads. My code is as follows:

Expand|Select|Wrap|Line Numbers
  1.         protected void Page_Load(object sender, EventArgs e)
  2.         {
  3.             if(!this.IsPostBack)
  4.                 ArrayToDataTable();   
  5.         }
  6.  
  7.         protected override void OnPreRender(EventArgs e)
  8.         {
  9.             GridView1.DataBind();
  10.             base.OnPreRender(e);
  11.         }
  12.  
  13.         private void ArrayToDataTable()
  14.         {
  15.             DataTable dt = new DataTable();
  16.             DataRow dr;          
  17.  
  18.             /*this converts returned array into an arraylist*/
  19.             ArrayList a = ArrayList.Adapter(ProductServices.GetAllProducts("CASH"));
  20.             ProductServices.Product prod = new ProductServices.Product();
  21.  
  22.             /*creates column names with same name as in Product object*/
  23.             foreach (PropertyInfo prop in prod.GetType().GetProperties())
  24.             {
  25.                 dt.Columns.Add("col_" + prop.Name, prop.PropertyType);
  26.                 //Response.Write(prop.PropertyType);
  27.             }
  28.  
  29.             dt.Columns.Add("col_ResellerPrice", typeof(System.Decimal));
  30.  
  31.  
  32.             foreach (ProductServices.Product p in a)
  33.             {
  34.                 dr = dt.NewRow();
  35.                 dr["col_StockCode"] = p.StockCode;
  36.                 dr["col_Name"] = p.Name;
  37.                 dr["col_Unit"] = p.Unit;
  38.                 dr["col_Brand"] = p.Brand;
  39.                 dr["col_Quantity"] = p.Quantity;
  40.                 dr["col_StockGroup"] = p.StockGroup;
  41.                 dr["col_LongDescription"] = p.LongDescription;
  42.                 dr["col_RetailPrice"] = p.RetailPrice;                                
  43.                 dr["col_Discount"] = p.Discount;
  44.                 dr["col_ResellerPrice"] = p.RetailPrice -(p.RetailPrice * (p.Discount / 100));
  45.                 //product.CategoryCode = 
  46.                 //product.DeliveryCost = 
  47.                 dt.Rows.Add(dr);
  48.             }
  49.             Cache["data"] = dt;               
  50.             GridView1.DataSource = dt;            
  51.         }
  52.  
  53.         protected void Button1_Click(object sender, EventArgs e)
  54.         {
  55.             DataTable cachedDT = (DataTable) Cache["data"];
  56.             cachedDT.DefaultView.RowFilter = "col_Quantity > 30";
  57.             cachedDT.DefaultView.Sort = "col_Quantity ASC";
  58.             GridView1.DataSource = cachedDT;            
  59.         }
  60.  
  61.         protected void Button2_Click(object sender, EventArgs e)
  62.         {
  63.             DataTable cachedDT = (DataTable)Cache["data"];
  64.             cachedDT.DefaultView.RowFilter = "";
  65.             cachedDT.DefaultView.Sort = "";
  66.             GridView1.DataSource = cachedDT;            
  67.         }
  68.  
I am using .net 2.0 on windows XP. This only happens in Firefox (currently using latest verion 2.0.0.11)

Thanks in advance
Jan 18 '08 #1
10 3701
radcaesar
759 Recognized Expert Contributor
Move your data binding inside the

if !(IsPostback) {} block.
Jan 18 '08 #2
pechar
56 New Member
Move your data binding inside the

if !(IsPostback) {} block.
I thought about this before but it won't work since I need it to DataBind() whether or not it is a PostBack. I'm using Caching to reduce postback to server. Any other idea?

Thanks
Jan 18 '08 #3
pechar
56 New Member
Anyone please? I really need to get this running and can't find a solution...
Jan 22 '08 #4
Plater
7,872 Recognized Expert Expert
Well you could always turn off event validation like it says. Unless you really need it?
Jan 22 '08 #5
pechar
56 New Member
Well you could always turn off event validation like it says. Unless you really need it?
Well I'd rather not turn it off. It's there to be used not disabled :/
Is this a firefox problem due to its rendering method??

Thanks
Jan 25 '08 #6
Plater
7,872 Recognized Expert Expert
Well it starts out disabled, you had to turn it on.
As to what firefox is doing, I don't know. Have to find out what is different between a successful request and a failed request.

If I had to guess, everytime you do a postback, there is like a "state" (probably some long unique string, "asp-state"?) that would get updated. I am thinking that firefox is retaining the old state until the new webpage is completely loaded, so clicking the button a lot in a row sends off multiple requests from the same "state", meanwhile the server keeps changing it's "state" and sees the extra requests as wrong since they have the wrong state.

Dunno a way around it.
Jan 25 '08 #7
pechar
56 New Member
Well it starts out disabled, you had to turn it on.
As to what firefox is doing, I don't know. Have to find out what is different between a successful request and a failed request.

If I had to guess, everytime you do a postback, there is like a "state" (probably some long unique string, "asp-state"?) that would get updated. I am thinking that firefox is retaining the old state until the new webpage is completely loaded, so clicking the button a lot in a row sends off multiple requests from the same "state", meanwhile the server keeps changing it's "state" and sees the extra requests as wrong since they have the wrong state.

Dunno a way around it.
Yes I think you're right and it's just what I was thinking too. Its all in the way firefox renders the page. I also notice that firefox lets teh user click buttons while a postback is happeneing. IE does not

Anyway thanks I'll have to think of another way.
Regards
Jan 25 '08 #8
satxEwallace
1 New Member
I know this thread is a bit old, but if anyone has this error, try adding the following line to the Page_Load method:

Response.Cache. SetNoStore();
Nov 26 '08 #9
pechar
56 New Member
Thanks will try this if I remember where I had the problem :)
Dec 11 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

11
8665
by: Robert | last post by:
Hi, My previous thread on this topic was too short on information so I I'll try again. When I tried out Firefox 1.5 beta some of my javascript did not work anymore. Here is some code to illustrate the different behaviour between Firefox 1.0x and 1.5. function init() { Event.prototype.__defineGetter__("srcElement", function()
5
4327
by: Andrea | last post by:
I am trying to alter css using javascript as well as use the innerHTML function. I have pasted below 3 forms that access getElementById in slightly different ways (I wanted to rule out that it was the method.) All 3 work fine on IE but only work momentarily on Firefox. For example, one form has text that changes from red to black when the user clicks the button. In IE it changes. In Firefox it changes for a split second then goes back...
5
1613
by: Steve JORDI | last post by:
Hi, I have a strange behavior when using IExplorer over FireFox. There is an html form that asks for the name of a city and has a dedicated field for that with a submit button next to it. In IExplorer, if I hit return instead of clicking the button, the PHP query on MySQL fails when reaching the mysql_fetch_object function. It's ok if I click the button.
1
33143
by: nebulus | last post by:
I'm working on a web app that under normal circumstances will be happy with the Session_OnEnd event, but when a user leaves a page by closing the browser by either Alt+F4 or just hitting the "X", I'll need to kill the session. Now, with the onbeforeunload event, I can handle this quite easily in IE, but in FireFox, it's another matter. For one thing, FireFox seems to empty out its event object on a page unload, so it's very hard to track...
3
2260
by: Josh Pencheon | last post by:
Hello. My name is Josh, from the UK. I'm 16, and having a spot of bother with some javascript I've been working on over the past few days, that gives a sliding menu. <html> <head> <script type="text/javascript"> <!-- menustatus = 'down'; bouncecount = 10;
2
4567
by: reynoldlariza | last post by:
Can somebody please help me, i tried playing around with IE6 and Firefox 2.0 browser for setting zIndexes and hide & show of divs. It seems to work to both. I tried repeatedly clicking on different divs on IE and no problem, but on firefox if I do the same, some divs just got hidden without notice. try clicking variably on different divs and it will happen... How do I make this stable? ----------------------------- <HTML> <HEAD>...
7
38002
by: John | last post by:
Hi Everyone, I'm having this extremely annoying problem with Internet Explorer 6, giving me an error message saying "unknown runtime error" whenever I try to alter the contents of a <divelement using innerHTML. Now, I've researched this problem on the web, and found many references to it, but none of them quite addressed my specific situation, and since my experience with JavaScript is limited, I was not able to adapt the solutions I...
1
3303
by: Jahamos | last post by:
Background: I have copy and pasted an Excel flowchart into a Dreamweaver html page. I created a frame on the top of the page as a viewer. I created hotspot links over the flowchart items. Each hotspot link should open a new anchor link in the top frame which references a different webpage. Problem: It works fine in Firefox. When clicking on the hotspots I get the appropriate html page anchor link to reference my html page and it correctly...
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.