页面间传参数问题(asp.net)

来源:百度知道 编辑:UC知道 时间:2024/09/24 03:49:30
登录页面时接受一个参数code;有权限判断没有权限的时候返回到TOP.aspx页面,并将接受的code,传给TOP.aspx页面。我写的如下,总是报错说'TOP.aspx?ID='+Code;这句中的Code没定义。为什么呀?高手帮忙。
string Code=Request.QueryString["code"].Trim().ToString(); Response.Write("<script>window.parent.location.href='TOP.aspx?ID='+Code;</script>");

("<script>window.parent.location.href='TOP.aspx?ID="+Code+"';</script>");

这样试试

改为如下则科正确运行了;
1(如果code是字符型的改成下面的)
string Code=Request.QueryString["code"].Trim().ToString(); Response.Write("<script>window.parent.location.href='TOP.aspx?ID='"+Code+"'</script>");
1(如果code是数字型的改成下面的)
string Code=Request.QueryString["code"].Trim().ToString(); Response.Write("<script>window.parent.location.href='TOP.aspx?ID="+Code+"</script>");