Wade wrote:
Thanks, please everyone take a look and give some feedback. I did run across one item I was not sure about after I sent it to Frans. That is in the Membership.ValidateUser().
-
Should the TypedList be changed to return something different like a row count for a matching username and password? Or should it just throw the exception as it does now?
-
If it does stay as throwing an exception in that method, should the exception be rethrown to the next level up the stack or should it just return FALSE to signify it as invalid? Basically, if someone takes the code as is and they do not put code in to handle the thrown exception then their application will crash.
Let me know what you all think.
Wade
Ummm...I haven't looked through the code myself but I will. In the meantime, I wouldn't think an exception should be thrown in this situation at all, except for "exceptional" situations. A person entering in an invalid username or password is not exceptional; It's a perfectly valid state. In this case I would throw an exception only if you got an error connecting to the db, or other such "exceptional" situations and then I would wrap it into a custom exception that explained the situation a bit better.
As for bubbling up the exception, as this is a service being consumed by any unknown code, it's reasonable to require them to put in exception handling as you need a mechanism to communicate that something has gone wrong. If they choose not to handle such situations that's their problem. However, again, I would wrap the exception and rethrow a custom one.
Just my .02
Jeff...