As you might have been able to tell by my last few posts about CSS Friendly Control Adapters - I'm in the middle of using the adapters on a project... and I'm running into all kinds of trouble. I finally came to the realization that many of the issues I've seen are all caused by the same bit of busted functionality - a double PostBack.
I just posted a new message to the CSS Friendly Control Adapters Forum over at asp.net, and I figured I'd re-post it here in hopes of drawing a little more attention to the issue.
The Forum Post
Recently I've been trying to use CSS Adapters along with the Membership/Roles/Provider controls and I've come across an issue where the Adapters cause the page to PostBack twice when using IE. (I tested using IE7 and FF 2.0... but others have confirmed the issue exists in IE6 as well).
For example, when using the CreateUserWizard and it's Adapter, clicking the submit button (which kicks off the CreateUserWizardStep) causes the page to PostBack twice in a row.
From an end-user point of view an error message is displayed on the screen, and rightly so. By stepping through the code in debug mode, I was able to verify that the first PostBack successfully created a user (and the user shows up in the aspnet_Membership table). However when they wizard tries to create the user for the 2nd PostBack it fails because the user already exists. Hence, an error is thrown and shown to the user.
A similar situation occurs with the PasswordRecovery control - the password is actually reset twice, and two emails are sent to the user.
You can confirm the double PostBack using Fiddler.
- fire up Fiddler and go to a page using one of the above controls (and their respective Adapter of course).
- Use the control.
- Look in the Fiddler HTTP Sessions window and you'll see duplicate POST requests for the same page.
Others have reported the same issue, though they didn't root-cause it as being a double-PostBack issue. See here. The only solution I've found so far is to disable the Control Adapter for the CreateUserWizard and PasswordRecovery controls.
Oh, and I do apologize for coming off a bit rude in the other post(s)... it was late, I was tired and frustrated... but now I'm in a much better state of mind.
So, to recap:
- using RTM version of CSS Adapters
- using asp.net 2.0 Membership/Profile/Roles controls with CSS Adapters
- Membership controls + CSS Adapters work fine with FF 2.0
- some (possibly all?) Membership controls + CSS Adapters cause double PostBack with IE7 (and others have confirmed same issue with IE6).
Got any ideas?
Again, that was just a re-post of the forum post I made earlier... but if you have any ideas or input please don't hesitate to either leave a comment here or over at the original asp.net Forum post.
Update
I have now confirmed this to be a problem with the following controls:
- CreateUserWizard
- PasswordRecovery
- ChangePassword
This leads me to believe that it is in fact an issue with the Adapters in general. The issue being: All of the Adapters are causing double PostBacks but only the controls listed above actually result in an error. The second PostBack causes the controls to throw errors because the control changed the state of the system in response the first PostBack.