【发布时间】:2011-04-06 06:57:51
【问题描述】:
嗨 我想在会话中将值存储在数组中。我想将它用于另一个页面。我怎么能这样做? 我使用 session 来存储数组的值如下:
int i, randno;
int[] a = new int[5];
for ( i = 0; i < 4; i++)
{
int flag = 0;
Random rnd = new Random();
randno = rnd.Next(1, 15);
for (int j = 0; j < i; j++)
{
if (a[j] == randno)
flag = 1;
}
if (flag == 0)
{
a[i] = randno;
}
else
{
i--;
}
}
Session["values"] = a;
在其他页面我使用了代码:
int[] a = (int[])Session["values"];
Response.Write(a);
这段代码对吗? 因为它没有给出价值。 但是检索到另一个页面然后它给出数组的最后一个值,在同一页面上它给出所有值。我想要数组的所有值。 ASP.NET, C# 谢谢你。
【问题讨论】:
标签: asp.net