•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 426,930 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,438 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 151690 | Replies: 74 | 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???![]()
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: May 2005
Posts: 20
Reputation:
Rep Power: 4
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:
Rep Power: 4
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
Location: Tennessee
Posts: 18
Reputation:
Rep Power: 4
Solved Threads: 1
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
SELECT COUNT(*) AS Num_of_User FROM tblUser WHERE (((tblUser.U_Name)=[@UserName]) AND ((tblUser.U_Password)=[@Password]));
While objReader.Read()
If CStr(objReader.GetValue(0)) <> "1" Then
lblMessage.Text = "Invalid Login!"
Else
objReader.Close() ' ||||| Close the Connections & Reader
Return True
End IfNotice 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:
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: 20
Reputation:
Rep Power: 4
Solved Threads: 1
Thanks a lot Miller it's really a stupid error, I make an error to the generation of the query.
It's obvous that the login page return always a different value for this field.
Thanks for your help and good work.
:lol: :lol:
It's obvous that the login page return always a different value for this field.
Thanks for your help and good work.
:lol: :lol:
•
•
Join Date: Apr 2005
Location: Tennessee
Posts: 18
Reputation:
Rep Power: 4
Solved Threads: 1
np man just trying to give back to da community. This site has helped me out alot.
Miller
Miller
•
•
Join Date: May 2005
Posts: 2
Reputation:
Rep Power: 0
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
•
•
Join Date: May 2005
Posts: 20
Reputation:
Rep Power: 4
Solved Threads: 1
Hi post the portion of code of the try-catch-finaly and if I found an error i post you the correct code.
Bye
Bye
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
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the ASP.NET Forum
- Previous Thread: ASP.Net Directory Problems
- Next Thread: Ready to take up a challenge

Linear Mode