开发者

ASP.NET Web Service and Membership

开发者 https://www.devze.com 2022-12-21 05:21 出处:网络
I try use Membership in asmx web service. I use Web Site Administration Tool, create som roles and users.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号