UserExists (WebSecurity Ref)
The UserExists method takes one string argument and checks to see if the user exists. It returns Boolean, so true or false.
Example
C# Code
@{ string username = ""; string msg = ""; if (IsPost) { username = Request["username"]; if (WebSecurity.UserExists(username)) { msg = "User Found!"; }else{ msg = "Cannot find user!"; } } }
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> @msg <form method="post"> <label>UserName</label> <input type="text" name="username"/> <input type="submit"/> </form> </body> </html>