SESSION 问题 求解
代码如下服务器端
[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;
}
}
客户端:
localhost.Service1SoapClient ws = new StockClient.localhost.Service1SoapClient();
ws.CookieContainer = new System.Net.CookieContainer();//这行报错
我有引用服务参考
可是查错时显示 'StockClient.localhost.Service1SoapClient' 不包含 'CookieContainer' 的定义
谢谢 --------------------编程问答-------------------- 先提高结帖率 再问问题 --------------------编程问答-------------------- 不好意思,我是新人还不太懂规矩,因为比较急,见谅。 --------------------编程问答-------------------- 你先看看你的'StockClient.localhost.Service1SoapClient' 里面包含不包含CookieContainer这个成员 --------------------编程问答--------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>--------------------编程问答-------------------- 不好意思,上面的代码贴错地方了 --------------------编程问答-------------------- 里面的确是没有这个成员,可是我查的一些文章都没有提到在服务端加入这个成员。貌似只要添加
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
private void Page_Load(object sender, EventArgs e)
{
this.DataGrid1.DataSource = GetProcessInfoAsDataSet();
this.DataGrid1.DataBind();
}
private DataSet GetProcessInfoAsDataSet()
{//获取网页上当前正在执行的ASP.NET进程信息
DataSet MyDataSet = new DataSet();
MyDataSet.Tables.Add(new DataTable());
MyDataSet.Tables[0].Columns.Add("ID", typeof(string));
MyDataSet.Tables[0].Columns.Add("Start Time", typeof(string));
MyDataSet.Tables[0].Columns.Add("Age", typeof(string));
MyDataSet.Tables[0].Columns.Add("Request Count", typeof(string));
MyDataSet.Tables[0].Columns.Add("Peak Memory", typeof(string));
ProcessInfo MyInfo = ProcessModelInfo.GetCurrentProcessInfo();
DataRow MyRow = MyDataSet.Tables[0].NewRow();
MyRow["ID"] = MyInfo.ProcessID;
MyRow["Start Time"] = MyInfo.StartTime;
MyRow["Age"] = MyInfo.Age;
MyRow["Request Count"] = MyInfo.RequestCount;
MyRow["Peak Memory"]= MyInfo.PeakMemoryUsed;
MyDataSet.Tables[0].Rows.Add(MyRow);
return MyDataSet;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>演示获取网页上当前正在执行的ASP.NET进程信息</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataGrid ID="DataGrid1" runat="server">
</asp:DataGrid></div>
</form>
</body>
</html>
[WebMethod(EnableSession = true)], 客服端就可以直接使用COOKIECONTINER了 。 谢谢
补充:.NET技术 , ASP.NET