Monday, April 28, 2008

using roles and logins

protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
Roles.AddUserToRole(CreateUserWizard1.UserName, "client");
}



protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
Login Login1 = (Login)LoginView1.FindControl("Login1");
if (Membership.ValidateUser(Login1.UserName, Login1.Password))
{
if (Request.QueryString["ReturnUrl"] != null)
{
Response.Write("redirect");
FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false);
}
else
{
FormsAuthentication.SetAuthCookie(Login1.UserName, false);
Response.Write("set cookie");
e.Authenticated = true;
}
}
else
{
Response.Write("you're not welcomed");
}
}








0 Comments:

Post a Comment

<< Home