Telerik Login Web form

1 posts, 0 answers
  1. Ashoo Sharda
    Ashoo Sharda avatar
    6 posts
    Member since:
    Mar 2010

    Posted 19 Apr 2010 Link to this post

    I used the just code to add a login webform. I am using custom membership provider and a custom role provider. The problem is that the User.Identity.Name for some reason doesn't get set and is always blank and hence I am unable to use the FormsAuthetication.Authenticate(user, passwd) method as it ivaluates to false.

    While creating the login page I did set it to use customproviders. We had comment out the lines and call the membership.validateUser to make it work.

    Please advise what I shd do so I can use the FormAuthentication class. Here is the .cs code for the login page

    public

     

    partial class LoginRadWindow : System.Web.UI.Page

     

    {

     

    protected void Page_Load(object sender, EventArgs e)

     

    {

     

    if (IsPostBack && Membership.ValidateUser(UsernameTextbox.Text, PasswordTextbox.Text))

     

    {

     

    //if (User.Identity.IsAuthenticated)

     

     

    RadScriptManager.RegisterStartupScript(this, this.GetType(), "closeDialog", "closeDialog();", true);

     

    }

    }

     

    protected void Login_OnClick(object sender, EventArgs e)

     

    {

     

    //if (FormsAuthentication.Authenticate(UsernameTextbox.Text, PasswordTextbox.Text))

     

     

    if (Membership.ValidateUser(UsernameTextbox.Text, PasswordTextbox.Text))

     

    {

    Session[

    "User"] = UsernameTextbox.Text;

     

     

    RadScriptManager.RegisterStartupScript(this, this.GetType(), "closeDialog", "closeDialog();", true);

     

     

    RadScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "window.top.location.href ='" + FormsAuthentication.GetRedirectUrl(UsernameTextbox.Text, false) + "';", true);

     

     

    //FormsAuthentication.RedirectFromLoginPage(UsernameTextbox.Text, false);

     

    }

     

    else

     

    Msg.Text =

    "Login failed. Please check your user name and password and try again.";

     

    }

    }

Back to Top