Unable to login in webserver to my page using asp.net membership

267 views Asked by At

I have used sqlProvider and asp.net login controls to login to my admin page. I created 4 users in the aspMembershipProvider. I am able to login using the same credentials in the localhost. Now that I have uploaded my website in BigRock domain but there I am not able to login. I have copied the database and all the tables. The users exist in aspnet_membership table and asp_Users table. But still I am not able to login. Here is my code what I have tried till now.

Login.aspx.cs

protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack)
            ViewState["LoginErrors"] = 0;
        FormsAuthentication.SignOut();



    }
    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        if (Membership.ValidateUser(Login1.UserName, Login1.Password))
        {
            FormsAuthentication.SetAuthCookie(Login1.UserName, true);
            string message = "Welcome "+Login1.UserName + "!!!";
            string url = "Admin/Admin.aspx";
            string script = "window.onload = function(){ alert('";
            script += message;
            script += "');";
            script += "window.location = '";
            script += url;
            script += "'; }";
            ClientScript.RegisterStartupScript(this.GetType(), "Redirect", script, true);

            Login1.FailureText = "";

        }
        else
        {
            // Username/password are not valid...
            e.Authenticated = false;


        }
    }

This is my web configuration file:

<membership defaultProvider="SqlProvider">
      <providers>
        <clear/>
        <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" 
         connectionStringName="ConnectionString" applicationName="" 
             enablePasswordRetrieval="false" enablePasswordReset="true" 
             requiresQuestionAndAnswer="false" requiresUniqueEmail="false" 
             passwordFormat="Hashed" maxInvalidPasswordAttempts="5" 
      minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0"/>
      </providers>
    </membership>

Is there anything we need to configure while we upload the site to server. If any further details are required I will provide. I need to find a solution for this.

1

There are 1 answers

0
Guruprasad J Rao On BEST ANSWER

First of all thanks to @Yevgeniy.Chernobrivets and @Rajesh Kumar for helping me out. As they said I jus need to set an application name in aspnet_Applications table. So I jus added the said details and now it working fine.