Eksporter (0) Skriv ut
Vis alt
EN
Dette innholdet er ikke tilgjengelig på ditt språk, men her er den engelske versjonen.
0 av 2 vurderte dette som nyttig - Vurder dette emnet

Login.LoginError Event

Occurs when a login error is detected.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)
public event EventHandler LoginError
<asp:Login OnLoginError="EventHandler" />

The LoginError event is raised when the credentials entered by the user are invalid. You can use the LoginError event to redirect the user to a custom error page, to offer additional help, or to log failed login attempts.

For more information about handling events, see Consuming Events.

The following code example uses the LoginError event to display Help links to the user when a login attempt fails.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
void OnLoginError(object sender, EventArgs e)
{
    Login1.HelpPageText = "Help with logging in...";
    Login1.CreateUserText = "Create a new user...";
    Login1.PasswordRecoveryText = "Forgot your password?";
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">
            <asp:Login id="Login1" runat="server" 
                CreateUserUrl="createUser.aspx" 
                HelpPageUrl="loginHelp.aspx" 
                PasswordRecoveryUrl="getPass.aspx" 
                OnLoginError="OnLoginError">
            </asp:Login>
        </form>
    </body>
</html>

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Vurderte du dette som nyttig?
(1500 tegn igjen)
Takk for tilbakemeldingen
Vis:
© 2014 Microsoft. Med enerett.