when i create user it aoutomaticaly logged in to newly created user how can i prevent it?

Posted by kalyani on Stack Overflow See other posts from Stack Overflow or by kalyani
Published on 2009-11-17T09:06:55Z Indexed on 2010/04/04 16:03 UTC
Read the original article Hit count: 219

Filed under:

heloo

public partial class CreateUser : System.Web.UI.Page
{
    TextBox username;
    protected void Page_Load(object sender, EventArgs e)
    {
        Class1.OpenConn();
        string[] rolesArray;
        if(!(IsPostBack))
        {        
            rolesArray = Roles.GetAllRoles();
            rdButtonListRoles.DataSource = rolesArray;
            rdButtonListRoles.DataBind();
        }
        if(IsPostBack)
        {
            Class1 cs = new Class1();
            username = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName");
            ProfileCommon newProf;
            newProf = Profile.GetProfile(username.Text);
            TextBox MobileNo, name, Sirname;
            name = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtname");
            Sirname = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtSirname");
           MobileNo = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("MobileNo");
        newProf.Name = name.Text;
        newProf.Sirname = Sirname.Text;
        newProf.MobileNo = MobileNo.Text;

        newProf.Save();
       RoleDiv.Visible = false;
    }
}


protected void ContinueButton_Click(object sender, EventArgs e)
{

    for (int i = 0; i < rdButtonListRoles.Items.Count; i++)
    {

        if (rdButtonListRoles.Items[i].Selected == true)
        {
            if (!Roles.IsUserInRole(username.Text, rdButtonListRoles.Items[i].Text))
            {
                Roles.AddUserToRole(username.Text, rdButtonListRoles.Items[i].Text.ToString());
            }
        }
        else
        {
            if (Roles.IsUserInRole(username.Text, rdButtonListRoles.Items[i].Text))
            {
                Roles.RemoveUserFromRole(username.Text, rdButtonListRoles.Items[i].Text.ToString());
            }
        }

    }


    Response.Redirect("ManageUser.aspx");
}
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{

}
}

plz give me the solution help me

© Stack Overflow or respective owner

Related posts about .NET