| | |
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 ajax alltypeofvideos appliances application asp asp.net bc30451 beginner box browser button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagridview datalist deployment development dgv dialog dropdownlist dynamic dynamically edit embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview google gridview gudi iis image javascript listbox login maps microsoft mobile mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent problem radio redirect registration relationaldatabases reportemail schoolproject search security select sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio vs2008 web webapplications webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers





