Hello i got some question why when i run my method in global.asax it don't run and when i use IHttp module it is workin any advice.
Maybe its caused of context.PostRequestHandlerExecute += new EventHandler(Application_EndRequest);
Is it posible to call it without Module?
Code Example:
Method that i run
public static void EndSession()
{
HttpContext context = HttpContext.Current;
if (context.Session != null)
{
ISession session = context.Session["Session"] as ISession;
if (context.Session["Session"] != null)
{
if (!session.Transaction.IsActive)
OpenTransaction(session);
session.Flush();
CommitTransaction(session);
session.Close();
context.Session["Session"] = null;
}
}
}
Global
private void Application_EndRequest(object sender, EventArgs e)
{
NhSessionHelper.EndSession();
}
IHTTPMODULE
namespace MME.DAL.SesionManager
{
internal class SessionRequest : IHttpModule
{
#region Public Methods
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.PostRequestHandlerExecute += new EventHandler(Application_EndRequest);
}
No comments:
Post a Comment