ASP.NET Web Service and Membership
I try use Membership in asmx web service. I use Web Site Administration Tool, create som roles and users.
In asmx web service I create Login method a test some users account. It's work ok.
[WebMethod]
public string Login(string userName, string userPassword)
{
if(Membership.ValidateUser(userName,userPassword))
{
return "Login succesfull";
}
return "Bad loginName or password";
}
The I add method on create user account.
[WebMethod]
public void CreateUser(string userName, string userPassword,
string userEmail, string userQuestion, string userAnswer)
{
MembershipCreateStatus status;
try
{
Membership.CreateUser(userName, userPassword,
userEmail, userQuestion, userAnswer, true, out status);
}
catch (MembershipCreateUserException ex)
{
throw ex;
}
开发者_开发知识库 catch(Exception ex)
{
throw ex;
}
}
Problem is, if I call webmethod CreateUser user account is not created. The user data are not written into database. I don't get any exception when I call webmethod CreateUser, where can be problem? Anybody help me? Thank you.
You have to follow up your strong password rolls by default you have to use capital letters numbers and special character i.e. use "PassW@rd22" Thanks, Hamid.
精彩评论