BQONE

深夜了,我还敲打着我的知已!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
需引用 System.Net;

windows集成验证:
        localhost.WebService math = new localhost.WebService();
        // Create a new instance of CredentialCache.
        CredentialCache credentialCache = new CredentialCache();
        // Create a new instance of NetworkCredential using the client
        // credentials.
        NetworkCredential credentials = new NetworkCredential("windows登录用户名", "登录密码");
        // Add the NetworkCredential to the CredentialCache.
        credentialCache.Add(new Uri(math.Url), "NTLM", credentials);
        // Add the CredentialCache to the proxy class credentials.
        math.Credentials = credentialCache;
        // Call the method on the proxy class.
        string Str = math.HelloWorld("keycom");

基本身份验证:
       localhost.WebService math = new localhost.WebService();
        math.Credentials = new System.Net.NetworkCredential("windows登录用户名", "登录密码");
        string Str = math.HelloWorld("keycom");

posted on 2007-07-23 13:13  BQONE  阅读(2820)  评论(1编辑  收藏  举报