在服务端中,我设置了ENABLE SESSION [WebMethod(EnableSession = true)]    可是到客户端中,我无法调用 ws.CookieContainer求解ERROR如下错误 1 'StockClient.localhost.Service1SoapClient' 不包含 'CookieContainer' 的定义,也找不到扩充方法 'CookieContainer' 来接受型别 'StockClient.localhost.Service1SoapClient' 的第一个引数 (您是否遗漏 using 指示词或组件参考?)

解决方案 »

  1.   

    没看明白你说的,如果是没有using,那就直接把命名空间带上好了
      

  2.   

    谢谢你的回复
    下面是代码
    客户端:
     localhost.Service1SoapClient ws = new StockClient.localhost.Service1SoapClient();        
     ws.CookieContainer = new System.Net.CookieContainer();
    服务器端
     [WebMethod(EnableSession = true)]
            public String start()
            {            if (Session["logged"] != null)
                {
                    String str;
                    str = "Welcome to our system please select from the following options" +
                                 "\n*************************************************************" +
                                 "\n1. View our stock" +
                                 "\n2. Buy stocks" +
                                 "\n3. Sell stocks" +
                                 "\n4. View trading report" +
                                 "\n5. View best selling stocks" +
                                 "\n*************************************************************";
                    return str;
                }
                else
                {
                    string  str= "User not Vaild, Please retry";
                    return str;
                }        }
    我有引用服务参考
    可是查错时显示 'StockClient.localhost.Service1SoapClient' 不包含 'CookieContainer' 的定义谢谢
      

  3.   

    就是在 ws.CookieContainer那里