嗨,我想在会话中存储数组内的值.我想将它用于另一个页面.我怎么能这样做?我使用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;
Run Code Online (Sandbox Code Playgroud)
在其他页面中,我使用了代码:
int[] a = (int[])Session["values"];
Response.Write(a);
Run Code Online (Sandbox Code Playgroud)
这段代码是对的?因为它没有赋予价值.但是检索到另一个页面然后它给出了数组的最后一个值,在同一页面上它给出了所有的值.我想要数组的所有值.Asp.net,c#谢谢.
嗨,当我重定向到asp.net中的其他页面时,我收到此错误,如下所示:"Firefox检测到服务器正在以永远无法完成的方式重定向此地址的请求." 这个错误究竟是什么意思?谢谢.