| | |
Simple ASP.Net Login Page (Using VB.Net)
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
Ok, I will do my best.
I need more details as to what the problem is. Provide code where you can, and I need you to answer a few questions:
1. Did you just copy and paste my code?
2. Are you using an Access or an SQL Database?
3. To clarify what you have said, you get a successful login with correct or incorrect data??
4. Are you using Visual Studio, ASP.Net Web Matrix, or something else? Why I am asking this, is to see if you have put breakpoints in your code to follow what data is being passed around.
The if you answer NO to the first question, please provide the code (or personal message me) so I can go through it for you.
I need more details as to what the problem is. Provide code where you can, and I need you to answer a few questions:
1. Did you just copy and paste my code?
2. Are you using an Access or an SQL Database?
3. To clarify what you have said, you get a successful login with correct or incorrect data??
4. Are you using Visual Studio, ASP.Net Web Matrix, or something else? Why I am asking this, is to see if you have put breakpoints in your code to follow what data is being passed around.
The if you answer NO to the first question, please provide the code (or personal message me) so I can go through it for you.
•
•
•
•
Originally Posted by lorf14plus
Excuse me I am a novice in asp.net and i prove to create a new alogin application wirh this code, but my page don't make any check on the table when I make the submit return all the time at the login page. i prove to enter correct data and wrong data can yiou help me please???![]()
•
•
Join Date: May 2005
Posts: 20
Reputation:
Solved Threads: 1
In advance thanks for your help.
1. I have copy all your code code that you have posted and I download the txt file that you have putted in the thread.
2. I have used for commodity the database ACCESS. (I make the prove with my database and with your database)
3. I don't now if the login goes well or not remain in all the case in the login page, probably return always a incorect login.
4. I using Visual Studio.Net.
To help you to help me I put the sorces code that I have entered in my page.
Thanks a lot for your help.
1. I have copy all your code code that you have posted and I download the txt file that you have putted in the thread.
2. I have used for commodity the database ACCESS. (I make the prove with my database and with your database)
3. I don't now if the login goes well or not remain in all the case in the login page, probably return always a incorect login.
4. I using Visual Studio.Net.
To help you to help me I put the sorces code that I have entered in my page.
Thanks a lot for your help.
•
•
Join Date: May 2005
Posts: 20
Reputation:
Solved Threads: 1
I have made other prove and I have correct the path of the database in the web.config, i put the correct path, but the objReader.Read() return always a true value.
I substitute the stored procedures with a normal query select * from usr_user but the result don't change the objReader.Read() is true, where is my error?? :cry: :cry:
Thanks for your help
I substitute the stored procedures with a normal query select * from usr_user but the result don't change the objReader.Read() is true, where is my error?? :cry: :cry:
Thanks for your help
•
•
Join Date: Apr 2005
Posts: 18
Reputation:
Solved Threads: 2
I dont really know how your wanting to go about this login but it doesnt look like its the same as Paladines. In his example he is making sure that "1" user in the database has a username password that match what was put into the textboxes. Example Notice "COUNT" if the query finds a username and password that match in the database it gonna return a value of "1"
Notice the .GetValue(0)) <> "1". Meaning if the value is not = "1" then "Invalid Login" During Paladines query if it doesnt find the matching username and password it will return a value of "0" therefore will not allow the login to take place.
So that being said if you want to do it the way he is you must change your Stored Procedure to:
I have went ahead and fixed it for you in your database so try it and tell me what you come up with.
Miller
ASP.NET Syntax (Toggle Plain Text)
SELECT COUNT(*) AS Num_of_User FROM tblUser WHERE (((tblUser.U_Name)=[@UserName]) AND ((tblUser.U_Password)=[@Password]));
ASP.NET Syntax (Toggle Plain Text)
While objReader.Read() If CStr(objReader.GetValue(0)) <> "1" Then lblMessage.Text = "Invalid Login!" Else objReader.Close() ' ||||| Close the Connections & Reader Return True End If
Notice the .GetValue(0)) <> "1". Meaning if the value is not = "1" then "Invalid Login" During Paladines query if it doesnt find the matching username and password it will return a value of "0" therefore will not allow the login to take place.
So that being said if you want to do it the way he is you must change your Stored Procedure to:
ASP.NET Syntax (Toggle Plain Text)
SELECT COUNT(*) AS Num_of_User FROM USR_USER WHERE (((USR_USER.USR_USERID)=[@UserName]) AND ((USR_USER.USR_PASSWORD)=[@Password]));
I have went ahead and fixed it for you in your database so try it and tell me what you come up with.
Miller
•
•
Join Date: May 2005
Posts: 2
Reputation:
Solved Threads: 1
Can somebody help me please? It Just Doesn't accept the Catch ex As Exception statement. What should i do ?
Thanks in advance
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'Exception' is not defined.
Source Error:
Line 101: End While
Line 102:
Line 103: Catch ex As Exception
Line 104: outputLabel.Text = "Error Connecting to Database!"
Line 105: Finally
Source File: C:\Trial\login.aspx.vb Line: 103
Thanks in advance
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'Exception' is not defined.
Source Error:
Line 101: End While
Line 102:
Line 103: Catch ex As Exception
Line 104: outputLabel.Text = "Error Connecting to Database!"
Line 105: Finally
Source File: C:\Trial\login.aspx.vb Line: 103
just for curiosity, but you do have the try part of the try-catch block above this code??
Have you rebuilt the project?
Have you rebuilt the project?
•
•
•
•
Originally Posted by phuture
Can somebody help me please? It Just Doesn't accept the Catch ex As Exception statement. What should i do ?
Thanks in advance
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'Exception' is not defined.
Source Error:
Line 101: End While
Line 102:
Line 103: Catch ex As Exception
Line 104: outputLabel.Text = "Error Connecting to Database!"
Line 105: Finally
Source File: C:\Trial\login.aspx.vb Line: 103
![]() |
Similar Threads
Other Threads in the ASP.NET Forum
- Previous Thread: ASP.Net Directory Problems
- Next Thread: Ready to take up a challenge
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 ajax alltypeofvideos anathor appliances application asp asp.net bc30451 beginner box browser button c# cac checkbox commonfunctions control dataaccesslayer database datagridview datalist deployment development dgv dialog dropdownlist dynamic dynamically edit editing embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview google gridview gudi iis image javascript list listbox login microsoft mobile mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent project radio redirect registration relationaldatabases reportemail richtextbox rows schoolproject search security select sessionvariables silverlight smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers




