Rank: Newbie Groups: Member
Joined: 8/12/2007 Posts: 4
|
Hi, I'm relatively new to this so please bare with me.
I thought it would be nice to stick my login and registration panels (based on asp membership provider) within Callbackpanels so that the whole page wasn't refreshed every time a validation error occurred.
However whatever I do, the whole page refreshes anyway.
Is there something which means these are special cases and can never work ?
If so can you guys suggest a framework which might allow callback functionality for login and registration? I've looked at the AuthenticationService for login, but this doesn't seem to help with Registration.
Accessing things directly e.g. Membership.validateuser throws back an error which makes me think that these aren't intended to work within callback.
Any help would be appreciated.
STeve
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Steve,
Have you set the trigger on the CallbackPanel? CallbackPanel does not automatically turn everything inside into AJAX calls. You must explicitly set which controls would trigger the callback.
Thanks
|
Rank: Newbie Groups: Member
Joined: 8/12/2007 Posts: 4
|
Hi,
I think so.
I tried several approaches. Firstly I just used the asp:login control id, then I imported the template detail so I could access the login button directly, neither seemed to work.
Thanks in advance.
Steve
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Steve,
We looked into the issue and found that our CallbackPanel actually worked as it supposes to. What happens is:
1. You type in user name and password; 2. You click Login. Our CallbackPanel does intercept this event and convert it into an AJAX call to the server; 3. The server processes the login request and authenticates the user. If the authentication is successful, it Redirect the user to ReturnUrl; 4. The call returns to our CallbackPanel on the client side, our CallbackPanel updates the page accordingly; 5. Our CallbackPanel sees the server has called Redirect, it processes the redirect;
The tricky part at here is ASP.NET membership API always call Redirect to redirect user to "ReturnUrl", which supposes to be another restricted page that triggers the Login page. However, it still does so even when both pages are the same. In this case, you will see the whole page being refreshed. However the refresh is not caused by page postback (which has been sucessfully turned into an AJAX callback), but it is caused by an unnecesssary Redirect call.
The easiest workaround I can see is to put the Login control inside an iframe. That way only the iframe itself is refreshed. You may still want to use a CallbackPanel even inside the iframe because the CallbackPanel gives you a couple of client side events that you may find useful to keep track of user status.
Thanks
|