|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DotNetNuke.Common;
using DotNetNuke.Entities.Tabs;
using DotNetNuke.Entities.Portals;
/// <summary>
/// Summary description for SessionTimeoutModule
/// </summary>
public class SessionTimeoutModule:IHttpModule
{
private HttpApplication app;
public void Init(HttpApplication context)
{
app = context;
app.PreRequestHandlerExecute += new EventHandler(app_PreRequestHandlerExecute);
}
void app_PreRequestHandlerExecute(object sender, EventArgs e)
{
if(app.Context.Session != null)
{
if (app.Context.Session.IsNewSession)
{
string szCookieHeader = app.Context.Request.Headers["Cookie"];
if (szCookieHeader != null && szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0)
{
int tabId = int.Parse(app.Context.Request.QueryString["TabId"]);
TabController tabController = new TabController();
PortalSettings portalSettings = (PortalSettings)app.Context.Items["PortalSettings"];
TabInfo tabInfo = tabController.GetTab(tabId, portalSettings.PortalId, true);
if (tabInfo.TabName != "SessionTimeout")
{
tabInfo = tabController.GetTabByName("SessionTimeout", portalSettings.PortalId);
string pageUrl = Globals.NavigateURL(tabInfo.TabID);
app.Context.Response.Redirect(pageUrl);
}
}
}
}
}
public void Dispose()
{
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.