Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int Test()
- {
- int p = 0;
- try
- {
- BasicHttpBinding binding = new BasicHttpBinding();
- binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
- binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
- EndpointAddress endpoint =
- new EndpointAddress(SPContext.Current.Web.Url + "/_vti_bin/TestWCF.svc");
- AjaxWCF.Test.WCFServiceClient proxy = new Test.WCFServiceClient(binding,endpoint);
- proxy.ClientCredentials.Windows.AllowedImpersonationLevel =
- System.Security.Principal.TokenImpersonationLevel.Impersonation;
- //Call web service.
- string [] pow = proxy.GetItems();
- //Refresh the UI.
- foreach (string i in pow)
- {
- p++;
- }
- }
- catch (Exception exc)
- {
- throw;
- }
- return p;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement