This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
/
Login.aspx.cs
54 lines (50 loc) · 1.68 KB
/
Login.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Login1_LoginError(object sender, EventArgs e)
{
System.Web.UI.WebControls.Login login_ctrl = (System.Web.UI.WebControls.Login)LoginView1.FindControl("Login1");
MembershipUser user = Membership.GetUser(login_ctrl.UserName);
Label login_error_details = (Label)LoginView1.FindControl("LoginErrorDetails");
if (user != null)
{
if (!user.IsApproved)
{
login_error_details.Text = "Your account has not yet been activated.";
}
else if (user.IsLockedOut)
{
login_error_details.Text = "Your account has been locked due to excessive incorrect login attempts.";
}
else
{
/* Login control handles other cases */
login_error_details.Text = "";
}
}
}
protected void Login1_LoggedIn(object sender, EventArgs e)
{
/* Override the ReturnURL for specific pages like Verify.
*/
string return_url = Request.QueryString["ReturnUrl"];
if (return_url == null || return_url.Contains("Verify.aspx"))
{
Response.Redirect("~/Overview.aspx");
}
}
}