返回首页

在1.aspx

string[] _array = new string[2];

_array[0]="field 1";

_array[1]="field 2";

Response.Redirect("2.aspx?file=" + _array);

在2.aspx

{C}
错误:
不能转换类型'字符串','字符串[]

回答

评论会员:游客 时间:2012/02/07
KARTHIKHarve:我觉得你可以不通过[]直接通过查询字符串的字符串而是尝试用会话变量,像这样的..第1页codeprelang="c#"spanclass="code-keyword"string/span[]_array=spanclass="code-keyword"new/spanspanclass="code-keyword"string/span[spanclass="code-digit"2/span];_array[spanclass="code-digit"0/span]=spanclass="code-string""/spanspanclass="code-string"field1"/span;_array[spanclass="code-digit"1/span]=spanclass="code-string""/spanspanclass="code-string"field2"/span;Session[spanclass="code-string""/spanspanclass="code-string"StrArray"/span]=_array;Response.Redirect(spanclass="code-string""/spanspanclass="code-string"2.aspx"/span);/pre/code第2页{体C3}希望这有助于..
爱德华・卢
评论会员:游客 时间:2012/02/07
2.aspx中:{的C4}你是刚刚拉的QueryString字符串,而不是一个数组。的问候,爱德华
OriginalGriff:如果你必须这样做,那么你将需要将其转换成一个字符串的字符串数组并把它转换当您完成。最明显的方法是使用分隔符没有出现在你的字符串("|"也许),并结合成一个字符串数组中的元素。然后,您可以使用String.Split转换为字符串数组