tags:

views:

76

answers:

1

I've written an ASP.NET application that runs on thousands of sites. But at least at one site, the following code fails:

void foo(Sender o, EventArgs e)  
{
    ....
}

<input runat="server" ....  OnServerClick="foo" ...

Have you ever experienced the OnServer events failing? I experimented at this site and couldn't come up with exactly the magic that makes it fail, but IIS Windows Authentication might be related, or this line of code might be related, based on turning things on and off, commenting things out:

void Page_Init (object sender, EventArgs e) {ViewStateUserKey = Session.SessionID;}

But how would these things be related? And again, this same code works at thousands of other sites.

So, have you ever encountered OnServer events failing triggered by setttings or conditions that were outside of your code?

+2  A: 

AutoEventWireUp="false" either in a page directive, setting in web.config or machine wide in machine.config

False = Event will not be bound automagically.

Other possibilities: EnableViewState setting or Viewstate is getting stripped/corrupted in transport.

MachineKey setting in configs and combination of Encrypting Viewstate

Temporary ASP.Net Files could be corrupt

Unpatched / Wrong .net runtime

Would probably start with the machine.config

Chad Grant
If that were so, wouldn't it fail in EVERY case?
Cerebrus
added some more possibilities Cerebrus
Chad Grant
@Deviant - thanks. Can you give more specifics about "MachineKey setting in configs and combination of Encrypting ViewState". My ViewStateUserKey code does encrypt the ViewState. What's the setting in machine.config I should be looking at?
Corey Trager
I added a link to the docs. MachineKey is the seeding/key mechanism for encryption in .net
Chad Grant
@Deviant - thanks again. I guess what I'm looking for is a way to reproduce the bug. How could I misconfigure Viewstate related settings, etc, to cause the bug?BTW, reading about AutoEventWireUp, if I understand it right, that can't be related. If there were a problem with my OnLoad, then I'd suspect AUtoEventWireUp.I do think Viewstate is related because commenting out some Viewstate related lines made the bug go away.
Corey Trager