我想我的手在asp.net + ajax + httpmodule上。asp.net ajax + http模块失败
我的形式
<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#代码
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模块
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);
}
}
当我删除从我的Web.config Ajax的工作原理的TimeModule。如果添加TimeModule,则标签不会显示消息“登录成功”。
删除ajax面板和httpmodule可用标签显示消息。那么,ajax面板如何与httpmodules相关?
更改了这一行:context.PostRequestHandlerExecute + = new EventHandler(context_PreRequestHandlerExecuteContent);现在仍然是o/p – 2010-04-19 09:16:54