note: here the site should be any windows authentication site.
. But in forms authentication its not going to be work. The reason is that the forms tries to access the http://server/site/_vti_bin/UserGroup.asmx service it will redirect to the login page of the current working site. Bcoz the user is not windows impersonated so he doesn't has the permission to access. The work around is to impersonate webservice with user windows domain credentials. If the webreference name is "GroupUser" follow below steps:
- GroupUser obj=new GroupUser();
- System.Net.NetworkCredential cred = new NetworkCredential(UserName,Password,Domain); [Import system.Net namespace]
- obj.Credentials=System.Net.CredentialCache.DefaultNetworkCredentials;
- Now call the method as obj.AddUserToGroup(groupName As String,userName As String,userLoginName As String,userEmail As String,userNotes As String)
This will work out.
No comments:
Post a Comment