views:

10

answers:

1

We're having an issue with a .NET 3.5 WebForms site where occasionally our error logs start filling up with the following error message:

"Multiple controls with the same ID 'ctl09' were found. FindControl requires that controls have unique IDs."

I know very little about the exception as I have never seen it while debugging locally and have never caught it in the error logs soon enough to run a remote debugging session. I do know that an application pool recycle fixes the issue.

This only affects a single [high traffic] page in the site. The strange thing is that the site uses the pre-4.0 ID generation logic. So, when the page is working, there isn't an html element in the entire view source that isn't some autogenerated control ID prefix followed by a the 'actual' IDs (i.e. ctl09_someID_someOtherID).

So, 2 primary questions, though any ideas are welcome:

  1. What would case a control to randomly stop being built correctly?
  2. Other than the Global.asax, how can I trap this error and force the control to ... recompile? App pool to recycle?

I'm pretty much stumped.

A: 
  1. Nothing as far as I'm aware, only an outside entity interferring with the page lifecycle or AJAX postback could potentially cause this, if each control is being generated, in turn, then you will not 'randomly' experience duplicate ids.

  2. I don't think this is a viable option, app pool recycle? No way, there's got to be a valid reason for this.

Perhaps some more info/code would be useful? Is it a particular page? Are you using ViewState? There's lots of reasons for 'dodgy' control ids.

Mantorok
It is a particular page and it does use one server control that stores data to the view state. I am actually in the process of removing the ViewState storage now. What about storing data to the view state might be causing the issue?
fordareh
Well ViewState has to find controls after the page is posted back, so if there are any inconsistencies it will bomb, horribly.Are you able to re-produce the error?
Mantorok