I am testing a group and they seem to be havng a memory leak. Opening the
page code below is eating up about 10 meg an hour. I am going threw it now to
try to find out what is going on. I a bit rusty with .net been waiting for
the next big release.
All service patches are up to date. What other things should I look at.
==============================
using System;
using System.Configuration;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OracleClient;
using Microsoft.ApplicationBlocks.ExceptionManagement;
namespace ASPNET.StarterKit.Portal {
public class DesktopDefault : System.Web.UI.Page {
protected System.Web.UI.HtmlControls.HtmlTableCell LeftPane;
protected System.Web.UI.HtmlControls.HtmlTableCell ContentPane;
protected System.Web.UI.HtmlControls.HtmlTableCell RightPane;
protected System.Web.UI.WebControls.Literal litClientSideTimeout;
public DesktopDefault()
{
Page.Init += new System.EventHandler(Page_Init);
}
private void Page_Init(object sender, EventArgs e) {
//
// CODEGEN: This call is required by the ASP.NET Web Form
Designer.
//
InitializeComponent();
//************************************************** *******************
//
// Page_Init Event Handler
//
// The Page_Init event handler executes at the very beginning of
each page
// request (immediately before Page_Load).
//
// The Page_Init event handler below determines the tab index of
the currently
// requested portal view, and then calls the
PopulatePortalSection utility
// method to dynamically populate the left, center and right
hand sections
// of the portal tab.
//
//************************************************** *******************
try
{
// Obtain PortalSettings from Current Context
PortalSettings portalSettings = (PortalSettings)
HttpContext.Current.Items["PortalSettings"];
bool labMode = false;
try
{
labMode = (ConfigurationSettings.AppSettings["Lab"].ToString() ==
"true");
}
catch
{
labMode = false;
}
if ((portalSettings.ActivePage.TabIndex == 0) &&
(Request.IsAuthenticated == false) && (labMode))
{
// This is the home page and we are not authenticated yet and we are in
lab mode (no WSL).
// Dynamically inject a signin login module into the top left-hand corner
// of the home page if the client is not yet authenticated
LeftPane.Controls.Add(Page.LoadControl("~/DesktopModules/SignIn.ascx"));
LeftPane.Visible = true;
}
else
{
// Ensure that the visiting user has access to the current page
if (portalSettings.ActivePage.userHasAccess == false)
{
Response.Redirect("~/Admin/AccessDenied.aspx");
}
}
clientSideTimeout();
LockManagement.releaseUnusedLocks(portalSettings.A ctivePage.PageId,
Session);
// Dynamically Populate the Left, Center and Right pane sections of the
portal page
if (portalSettings.ActivePage.Modules.Count == 0)
{
Page.Controls.Add(new LiteralControl("<" + "br" + ">This page is
intentionally blank.<" + "br" +">"));
}
else if (portalSettings.ActivePage.Modules.Count > 0)
{
// Loop through each entry in the configuration system for this tab
foreach (ModuleSettings _moduleSettings in
portalSettings.ActivePage.Modules)
{
Control parent = Page.FindControl(_moduleSettings.PaneName);
// If no caching is specified, create the user control instance and
dynamically
// inject it into the page. Otherwise, create a cached module
instance that
// may or may not optionally inject the module into the tree
if ((_moduleSettings.CacheTime) == 0)
{
try
{
PortalModuleControl portalModule = (PortalModuleControl)
Page.LoadControl(_moduleSettings.DesktopSrc);
portalModule.PortalId = portalSettings.PortalId;
portalModule.ModuleConfiguration = _moduleSettings;
if (_moduleSettings.HasBcu == true)
{
if (false == UserAdmin.hasAccessToBcus(Context.User.Identity.Na me,
portalSettings.ActivePage.PageId))
{
portalModule = (PortalModuleControl)
Page.LoadControl("admin/BcuAccessDenied.ascx");
portalModule.PortalId = portalSettings.PortalId;
portalModule.ModuleConfiguration = _moduleSettings;
}
}
parent.Controls.Add(portalModule);
}
catch (Exception ex)
{
ExceptionInformation exInfo = new ExceptionInformation();
exInfo.Category = "General";
exInfo.Severity = ExceptionSeverity.Error;
exInfo.Name = ex.GetType().ToString();
ExceptionManager.Publish ( ex, exInfo );
Server.ClearError();
// Dynamically inject error message but try to load the other
modules anyway
parent.Controls.Add(new LiteralControl("<" + "br" + ">Error loading
module. The details of the error have been saved for the support team.<" +
"br" +">"));
parent.Visible=true;
}
}
else
{
CachedPortalModuleControl portalModule = new
CachedPortalModuleControl();
portalModule.PortalId = portalSettings.PortalId;
portalModule.ModuleConfiguration = _moduleSettings;
parent.Controls.Add(portalModule);
}
// Dynamically inject separator break between portal modules
parent.Controls.Add(new LiteralControl("<" + "br" + ">"));
parent.Visible = true;
}
}
else
{
throw new ApplicationException("Invalid module count on page.");
}
}
catch( Exception ex )
{
ExceptionInformation exInfo = new ExceptionInformation();
exInfo.Category = "General";
exInfo.Severity = ExceptionSeverity.Error;
exInfo.Name = ex.GetType().ToString();
ExceptionManager.Publish ( ex, exInfo );
Server.ClearError();
Response.Write("<" + "br" + ">Error loading page.<" + "br" +">The
details of the error have been saved for the support team.<" + "br" +">");
}
}
private void clientSideTimeout()
{
string clientScript = "<script language=javascript>\n<!-- \n";
if (Application["ScreenTimeout"] == null)
{
// get the timeout value from the database, cache it to the
application[] object
UserParamDB db = new UserParamDB();
string screenTimeout = db.GetParameter("ScreenTimeout");
try
{
int timeout = Int32.Parse(screenTimeout);
if ((timeout > 60) && (timeout < 900))
{
Application["ScreenTimeout"] = timeout * 1000;
}
else
{
Application["ScreenTimeout"] = 600000;
}
}
catch
{
Application["ScreenTimeout"] = 600000;
}
}
clientScript += " var timer = null;\n ";
clientScript += " function autoReload() { \n";
clientScript += " window.location = '" + Request.ApplicationPath +
"/admin/TimedOut.aspx'; \n";
clientScript += " }\n";
clientScript += " timer=setTimeout('autoReload()', " +
Application["ScreenTimeout"].ToString() + "); \n";
clientScript += " -->\n</script>\n";
this.litClientSideTimeout.Text = clientScript;
}
#region Web Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}
===============================
<%@ Page language="c#" CodeBehind="DesktopDefault.aspx.cs"
AutoEventWireup="false" Inherits="ASPNET.StarterKit.Portal.DesktopDefault" %>
<%@ Register TagPrefix="ASPNETPortal" TagName="Footer"
Src="DesktopPortalFooter.ascx" %>
<%@ Register TagPrefix="ASPNETPortal" TagName="Banner"
Src="DesktopPortalBanner.ascx" %>
<%@ OutputCache Duration="1" Location="none" VaryByParam="none" %>
<HTML>
<HEAD>
<title>FMC EBC</title>
<%--
The DesktopDefault.aspx page is used to load and populate each Portal
View. It accomplishes
this by reading the layout configuration of the portal from the Portal
Configuration
system, and then using this information to dynamically instantiate portal
modules
(each implemented as an ASP.NET User Control), and then inject them into
the page.
--%>
<LINK href="EBC.CSS" type="text/css" rel="stylesheet">
<asp:literal id="litClientSideTimeout" runat="server"></asp:literal>
</HEAD>
<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0"
marginwidth="0" marginheight="0">
<form runat="server">
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr vAlign="top">
<td colSpan="2"><ASPNETPORTAL:BANNER id="Banner" runat="server"
SelectedTabIndex="0"></ASPNETPORTAL:BANNER></td>
</tr>
<tr>
<td><br>
<table cellSpacing="0" cellPadding="4" width="100%" border="0">
<tr vAlign="top" height="*">
<td width="5">
</td>
<td id="LeftPane" width="170" runat="server" Visible="false"></td>
<td width="1"></td>
<td id="ContentPane" width="*" runat="server" Visible="false"></td>
<td id="RightPane" width="230" runat="server" Visible="false"></td>
<td width="10">
</td>
</tr>
</table>
</td>
</tr>
</table>
<aspnetportal:Footer id="Footer" runat="server"></aspnetportal:Footer>
</form>
</body>
</HTML>