asp.net ajax + http module fails
- by Sri Kumar
Hi,
I am trying my hands on asp.net+ajax+httpmodule.
My Form
<form id="LoginForm" runat="server">
<asp:ScriptManager ID="LoginScriptMgr" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="LoginPanel" runat="server">
<ContentTemplate>
<asp:Label ID="lblLoginHeader" Text="Login" runat="server"></asp:Label>
<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
<asp:Button ID="btnLogin" Text="Login" runat="server" OnClick="Login" />
<asp:Label ID="lblLoginStatus" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
C# Code
protected void Login(object sender, EventArgs e)
{
lblLoginStatus.Text = "Login Successful";
}
Web.config
<httpModules>
<add name="TimeModule" type="MyWebPortal.App_Code.TimeModule,App_Code"/>
</httpModules>
HTTP Module
public class TimeModule : IHttpModule
{
private HttpApplication oApps = null;
public void Dispose()
{
}
public void Init(System.Web.HttpApplication context)
{
oApps = context;
context.PreSendRequestContent += new EventHandler
(context_PreSendRequestContent);
}
void context_PreSendRequestContent(object sender, EventArgs e)
{
string message = "<!-- This page is being processed at " + System.DateTime.Now.ToString() + " -->";
oApps.Context.Response.Output.Write(message);
}
}
When i remove the TimeModule from Web.config my ajax works. If add the TimeModule then the label doesn't show the message "Login Successful".
Removing the ajax panel and with httpmodule available the label shows the message. So, how ajax panel was related to httpmodules?