单击WebFormSite

时间:2019-03-29 06:27:19

标签: c# asp.net

在网络表单上,我可以将上传文件中的502个数据点添加到系列中。

protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
    if (FileUpload1.HasFile)
    {
        try
        {

            if (FileUpload1.PostedFile.FileName.Contains(".txt")               
            {

                    string filename = Path.GetFileName(FileUpload1.FileName);
                    FileUpload1.SaveAs(Server.MapPath("~/") + filename);
                    filename = Server.MapPath("~/") + filename; //Path.GetFileName(FileUpload1.FileName);
                    chart1.Series.Clear();    
                    globalseries.Points.Clear();
                    FileManagement file = new FileManagement(filename);                        
                    globalseries = file.tempseries;                       
                    chart1.Series.Add(globalseries);                        
                    Debug.WriteLine(" At open file: globalseries.count = " + globalseries.Points.Count);

            }
        }
        catch (Exception ex)
        {
            Label1.Text = "Error: " + ex.Message;
        }
    }
}

但是当我单击其他按钮来进一步处理系列时;它被清除了。为什么添加到该系列中的数据点丢失了?

 protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
    Debug.WriteLine("Menu1_MenuItem: chart1.ChartArea.Count = " + chart1.ChartAreas.Count);
    Debug.WriteLine("Menu1_MenuItem: chart1.Series.Count = " + chart1.Series.Count);
    Debug.WriteLine("Menu1_MenuItem: globalseries.count = " + globalseries.Points.Count);
}

Immediate window显示在menu_click上该系列。Points.Count= 0。

我什至在web.config中检查了会话超时,我已将其设置为45,但问题仍然存在。我在这里还想念其他东西吗?

	
	 <sessionState mode="InProc"  cookieless="false" timeout="45">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
      </providers>
    </sessionState>

0 个答案:

没有答案