我在global.asax.cs类写 protected void Session_Start(Object sender, EventArgs e)
{
try
{
int a[]={1,2};
Session["c"] = a;
}
catch
{
throw;
}
}
在页面调用时 int[] a = (int[])Session["c"];
TextBox1.Text = a[0].ToString();
结果报错,说未将对象引用设置到对象的实例。
为什么?
{
try
{
int a[]={1,2};
Session["c"] = a;
}
catch
{
throw;
}
}
在页面调用时 int[] a = (int[])Session["c"];
TextBox1.Text = a[0].ToString();
结果报错,说未将对象引用设置到对象的实例。
为什么?
{
int[] a ={ 1,2,5};
Session["a"] = a; if (Session["a"] != null)
{
int[] b = (int[])Session["a"];
for (int i = 0; i < b.Length; i++)
Response.Write(b[i].ToString() +"<br />");
}
}