Communication Method

Sep 9, 2008 at 9:20 PM
Edited Sep 9, 2008 at 9:22 PM
The trickiest issue surrounding implementing this control is how to communicate with the server to check the username's availability.

I think the most straightforward way of going about it will be to use the same model that the AutoComplete Extender uses.  Allow the developer to simply provide a web service path and method name.  That method will accept a string and return a boolean.

This way, no web.config edits will be necessary to use the control, and the developer can easily implement a service to validate against a custom authentication store.  However, if they're using the ASP.NET MembershipProvider, it will be as easy as:

public bool IsUsernameAvailable(string Username)
  return Membership.GetUser(Username) == null;

Sep 19, 2008 at 12:59 AM
I think that's a pretty good approach.  I do, however, think there might be some room for extensibility.  We have to ask ourselves if we want this control to have a very narrow scope or if we want to make it flexible for multiple purposes. 

Could this control be used to provide username suggestions if the entered name is taken, for instance? 

If we want to keep the scope very narrow, then I think your stated approach is close to perfect.  What if the developer wants to specify what the text is output for the error message?
Sep 24, 2008 at 11:47 PM
Couldn't we instead create an interface that the IsUsernameAvailable web service AND page.validate call, rather than using reflection to invoke a web service?  I feel like the web service should not have any code besides creating an instance of a class and invoking a method.  Any thoughts?