I'm a begginner in ASP.NET :-O ,
I'm writing a website in VS2010 based on asp.net webForm, and bump into the problem below :doh: :
In my website, I need to refresh data to realize realtime monitoring. So I used asp.net ajax extension server controls
Timer and UpdatePanel to perform partial page refreshment.
The website works well except it causes the
client browser(IE,Safari,Chrome, except Firefox) having
memory leak problem!
After the website page run several hours, the client browers can take up huge memories. I searched on Internet but haven't figured out any solutions.
Can anyone help?:confused:
Thanks with all my heart~:rose:
My
simplified codes are like this:
Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick" />
<div>
<asp:Label ID="Label1" runat="server" Text="你好,Hello" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
Default.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = "Refreshed value:" + DateTime.Now.ToString();
}
}