|
<asp:login id="LoginUser" runat="server" onauthenticate="OnAuthenticate"
onloggedin="OnLoggedIn" onloggingin="OnLoggingIn" destinationpageurl="~">
</asp:login>
protected void OnAuthenticate(object sender, AuthenticateEventArgs e)
{
e.Authenticated = false; //認證失敗
if (String.Compare(ctlLogin.UserName, "foo", true) == 0 &&
String.Compare(ctlLogin.Password, "bar", false) == 0)
{
e.Authenticated = true; //認證成功,則會自動執行OnLoggedIn Function,進行Redirect
}
}
protected void OnLoggedIn(object sender, EventArgs e)
{
'覆蓋 ReturnUrl頁面參數
Response.Redirect("~"); // 或是 Response.Redirect(Login1.DestinationPageUrl)
}
Login事件說明:
LoggedIn 發生於使用者登入網站且已經過驗證時。
LoggingIn 發生於使用者送出登入資訊之後,進行驗證之前。
Reference:
http://netomatix.com/Development/LoginControlBasic.aspx
http://zh-tw.w3support.net/index.php?db=so&id=33166
http://www.sharepointdev.net/sha ... irectly-18817.shtml |
|