Web Services引用MemberShip的問題
方法是這樣寫的,但是結果Memeber is nothing<WebMethod()> _
Public Function MemberList(ByVal username As String) As String
Dim user As MembershipUser = Membership.GetUser(username)
If user Is Nothing Then
Return "None"
Else
Return username
End If
End Function
請問,如果才能實現這個功能???
多謝大俠指點。。。。。 --------------------编程问答-------------------- public class MembershipProvider : System.Web.Services.WebService
{
protected System.Web.Security.MembershipProvider GetProvider(string providerName, string applicationName)
{
System.Web.Security.MembershipProvider provider;
if ((providerName != null) && (System.Web.Security.Membership.Providers[providerName] != null))
{
provider = System.Web.Security.Membership.Providers[providerName];
}
else
{
provider = System.Web.Security.Membership.Provider;
}
if (applicationName != null)
{
provider.ApplicationName = applicationName;
}
return provider;
}
protected MembershipUser ConvertUser(System.Web.Security.MembershipUser user)
{
if (user == null) return null;
MembershipUser membershipUser = new MembershipUser();
membershipUser.Comment = user.Comment;
membershipUser.CreationDate = user.CreationDate;
membershipUser.Email = user.Email;
membershipUser.IsApproved = user.IsApproved;
membershipUser.IsLockedOut = user.IsLockedOut;
membershipUser.IsOnline = user.IsOnline;
membershipUser.LastActivityDate = user.LastActivityDate;
membershipUser.LastLockoutDate = user.LastLockoutDate;
membershipUser.LastLoginDate = user.LastLoginDate;
membershipUser.LastPasswordChangedDate = user.LastPasswordChangedDate;
membershipUser.PasswordQuestion = user.PasswordQuestion;
membershipUser.ProviderName = user.ProviderName;
membershipUser.ProviderUserKey = user.ProviderUserKey;
membershipUser.UserName = user.UserName;
return membershipUser;
}
protected System.Web.Security.MembershipUser ConvertUser(System.Web.Security.MembershipProvider provider, MembershipUser user)
{
if (user == null) return null;
System.Web.Security.MembershipUser membershipUser =
new System.Web.Security.MembershipUser(provider.Name,
user.UserName,
user.ProviderUserKey,
user.Email,
user.PasswordQuestion,
user.Comment,
user.IsApproved,
user.IsLockedOut,
user.CreationDate,
user.LastLoginDate,
user.LastActivityDate,
user.LastPasswordChangedDate,
user.LastLockoutDate);
return membershipUser;
} --------------------编程问答-------------------- 不理解,有沒有具體點的代易做图可以看看 --------------------编程问答-------------------- 期待有人能解決這個問題。。。。。。 --------------------编程问答-------------------- 什么呀
补充:.NET技术 , Web Services