我想我的手在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