我想把计算的一个w[]数组传递到另一个页面中,我用session写,,,大家看看错在哪里,我一直传递不过去,
 protected void topsis_Click(object sender, EventArgs e)
    {
        
        Session["weight1"] =System .Convert .ToString ( w[1]);
        Session["weight2"] = System.Convert.ToString(w[1]);
        Session["weight3"] = System.Convert.ToString(w[1]);
        Session["weight4"] = System.Convert.ToString(w[1]);
        Session["weight5"] = System.Convert.ToString(w[1]);
        Session["weight6"] = System.Convert.ToString(w[1]);
       Response.Redirect("~/mymaster/topsis.aspx");
}
接收的部分;
double[] wei= new double[7];
protected void Page_Load(object sender, EventArgs e)
    {   wei[1] = System.Convert.ToDouble(Session["weight1"]);
        wei[2] = System.Convert.ToDouble(Session["weight2"]);
        wei[3] = System.Convert.ToDouble(Session["weight3"]);
        wei[4] = System.Convert.ToDouble(Session["weight4"]);
        wei[5] = System.Convert.ToDouble(Session["weight5"]);
        wei[6] = System.Convert.ToDouble(Session["weight6"]);
        Session.Remove("weight1");
        Session.Remove("weight2");
        Session.Remove("weight3");
        Session.Remove("weight4");
        Session.Remove("weight5");
        Session.Remove("weight6");
            
}
数据传递不过去,大家看看错在哪里?

解决方案 »

  1.   

    首先确认值之前有值,
    然后把
     wei[1] = System.Convert.ToDouble(Session["weight1"]);
            wei[2] = System.Convert.ToDouble(Session["weight2"]);
            wei[3] = System.Convert.ToDouble(Session["weight3"]);
            wei[4] = System.Convert.ToDouble(Session["weight4"]);
            wei[5] = System.Convert.ToDouble(Session["weight5"]);
            wei[6] = System.Convert.ToDouble(Session["weight6"]);
            Session.Remove("weight1");
            Session.Remove("weight2");
            Session.Remove("weight3");
            Session.Remove("weight4");
            Session.Remove("weight5");
            Session.Remove("weight6");放到
    if(!IsPostBack)里
      

  2.   

    Session["weight1"] =System .Convert .ToString ( w[1]);
            Session["weight2"] = System.Convert.ToString(w[1]);
            Session["weight3"] = System.Convert.ToString(w[1]);
            Session["weight4"] = System.Convert.ToString(w[1]);
            Session["weight5"] = System.Convert.ToString(w[1]);
            Session["weight6"] = System.Convert.ToString(w[1]);
    怎么好多个w[1],是笔误还是码误?
      

  3.   

    晕.这么多数据,都放Session里啊.
      

  4.   

    确认放入Session时有值
    不能禁用Cookie
      

  5.   

    用了这么多Session,改用QueryString吧!!
      

  6.   

    WWF(Microsoft Windows Workflow Foundation)中文社区:http://www.wwfcn.net
      

  7.   

    35526520现广纳贤才,是ASP.NET交流群,热烈欢迎各热爱C#学习的同志加入
      

  8.   

    传值时只要w[1]有值,是没问题的,只是string转换成double时有点问题.