-
Notifications
You must be signed in to change notification settings - Fork 1
/
CreateUser.aspx.cs
49 lines (37 loc) · 1.31 KB
/
CreateUser.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class CreateUser : System.Web.UI.Page
{
String str;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
System.Web.Security.MembershipCreateStatus status;
System.Web.Security.Membership.CreateUser
(CreateUserWizard1.UserName, CreateUserWizard1.Password, CreateUserWizard1.Email,
CreateUserWizard1.Question, CreateUserWizard1.Answer, true, out status);
str = CreateUserWizard1.Email;
string[] temp = CreateUserWizard1.Email.Split( new string[] {"@"}, StringSplitOptions.None);
if (temp[1].Equals("learn.senecac.on.ca"))
{
System.Web.Security.Roles.AddUserToRole
(CreateUserWizard1.UserName, "Student");
}
else if (temp[1].Equals("senecacollege.ca"))
{
System.Web.Security.Roles.AddUserToRole
(CreateUserWizard1.UserName, "Staff");
}
else
{
System.Web.Security.Roles.AddUserToRole
(CreateUserWizard1.UserName, "Public");
}
}
}