2013-11-01 22 views
0

我有一個更新面板控件包裝登錄控件。我希望登錄後的用戶轉到已經設置的changepassword控件。但是,當我輸入正確的用戶名和密碼字段,然後單擊登錄時,頁面刷新。我該如何阻止?在.net的updatepanel控件中使用asp:登錄控件

<asp:UpdatePanel ID="updateLogin" runat="server"> 
    <ContentTemplate> 
     <asp:Login id="LoginAuth" runat="server"> 
      <LayoutTemplate> 

      The username and password controls are here. 

      <asp:imagebutton id="Login" Enabled="true" OnClick="Login_OnClick" CommandName="Login" runat="server" AlternateText="Login" ImageUrl="powerstats/inc/img/login_up_gray.png"></asp:imagebutton> 

      </LayoutTemplate> 
     </asp:Login> 
    </ContentTemplate> 
</asp:UpdatePanel> 

回答

0

您可以訂閱LoggedIn事件。一旦用戶被成功驗證,它就會被調用。

<asp:Login id="LoginAuth" runat="server" OnLoggedIn="LoginAuth_LoggedIn"> 
    .... 
</asp:Login> 

protected void LoginAuth_LoggedIn(object sender, EventArgs e) 
{ 
    Response.Redirect("Changepassword.aspx"); 
} 
+0

我希望它出現在同一頁上的圖層上,那是possibe? – cdub

+0

您可以在** LoggedIn **事件中設置'LoginAuth.Visible = false'和'PasswordRecovery.Visible = true'。 – Win