Thursday, September 25, 2008

ASP.NET Authentication Web Service

The ASP.NET authentication web service is a really cool way to avoid using the UpdatePanel, but you may want to think about it when you've got a really funky custom-built Membership provider.

When I started building a conventional ASP.NET application, I added in the code to load user information into the membership provider as I was retrieving the user object from the database anyway. It got me a little extra performance and everyone was happy.

Then, the need to use AJAX came up and I used the Authentication Service from within client-side Javascript to perform authentication. Using a regular user account to log into the system resulted in an error; further investigation revealed that the session object wasn't accessible so I looked around for any setting that would enable accessing session state. Unfortunately, there was none :-(
I then added an extra call from the client-side script to call another web method that would load the user object into a session variable to avoid errors on other pages.

I guess sometimes, a performance hack can come back to bite you.

1 comment: