| | |
Your login attempt was not successful. Please try again PROBLEM
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2009
Posts: 2
Reputation:
Solved Threads: 0
Hi,
I have a problem with my login control. I changed the code in order to use my own database (SQL Server 2005) and no matter what i do i get the message "Your login attempt was not successful. Please try again. "!!!
in the web.config file i chose my own connection string leading to my database, so i don't use the default database for the login authorization.
Do i have to change anything else in there?
Check out my code below
Please anyone who can help i really appreciate it!!!!!!!
When I debugged the code I get the exception on the line 55
thank u very much
Nikolas
I have a problem with my login control. I changed the code in order to use my own database (SQL Server 2005) and no matter what i do i get the message "Your login attempt was not successful. Please try again. "!!!
in the web.config file i chose my own connection string leading to my database, so i don't use the default database for the login authorization.
Do i have to change anything else in there?
Check out my code below
Please anyone who can help i really appreciate it!!!!!!!
When I debugged the code I get the exception on the line 55
asp.net Syntax (Toggle Plain Text)
public partial class _Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { try { string uname = Login1.UserName.Trim(); //Get the username from the control string password = Login1.Password.Trim(); //get the Password from the control bool flag = AuthenticateUser(uname, password); if (flag == true) { e.Authenticated = true; Login1.DestinationPageUrl = "Admin.aspx"; } else { e.Authenticated = false; } } catch (Exception) { e.Authenticated = false; } } private bool AuthenticateUser(string uname, string password) { bool bflag = false; string connString = "Data Source = localhost; Initial Catalog = Telemedicine; User Id=sa; Password=sa;"; string strSQL = "select * from Administrator where UserName =’" + uname + "‘ AND Password =’" + password + "‘"; DataSet userDS = new DataSet(); SqlConnection m_conn; SqlDataAdapter m_dataAdapter; SqlCommand m_Command; try { m_conn = new SqlConnection(connString); m_conn.Open(); m_dataAdapter = new SqlDataAdapter(strSQL, m_conn); m_dataAdapter.Fill(userDS); m_conn.Close(); } catch (Exception ex) { userDS = null; } if (userDS != null) { if (userDS.Tables[0].Rows.Count > 0) bflag = true; } return bflag; } }
thank u very much
Nikolas
Last edited by peter_budo; Apr 25th, 2009 at 5:29 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- JSP database connectivity according to Model View Controller (MVC) Model 2 (JSP)
- Email code problem (PHP)
- Please Help me with frmLogin (Visual Basic 4 / 5 / 6)
- loading roles from DB to auth cookie (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: GridView Control
- Next Thread: Refreshing a dropdownlist in a FormView Template
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child class click compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dialog dropdownmenu dynamic edit embeddingactivexcontrol feedback findcontrol flash flv form forms google grid gridview homeedition hosting iframe iis javascript jquery list maps menu mobile mono mssql multistepregistration nameisnotdeclared novell objects order problem ratings rotatepage save search security serializesmo.table silverlight smartcard sql ssl suse textbox tracking treeview typeof unauthorized validation vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment wizard xml





