943,949 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 278347
  • ASP.NET RSS
You are currently viewing page 7 of this multi-page discussion thread; Jump to the first page
May 3rd, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

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.


Quote 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???
Team Colleague
Reputation Points: 211
Solved Threads: 27
Master Poster
Paladine is offline Offline
793 posts
since Feb 2003
May 4th, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

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.
Attached Files
File Type: zip ASP.NET.zip (42.6 KB, 109 views)
Reputation Points: 10
Solved Threads: 1
Newbie Poster
lorf14plus is offline Offline
20 posts
since May 2005
May 4th, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
lorf14plus is offline Offline
20 posts
since May 2005
May 5th, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

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
ASP.NET Syntax (Toggle Plain Text)
  1. SELECT COUNT(*) AS Num_of_User
  2. FROM tblUser
  3. WHERE (((tblUser.U_Name)=[@UserName]) AND ((tblUser.U_Password)=[@Password]));
Notice "COUNT" if the query finds a username and password that match in the database it gonna return a value of "1"
ASP.NET Syntax (Toggle Plain Text)
  1. While objReader.Read()
  2. If CStr(objReader.GetValue(0)) <> "1" Then
  3. lblMessage.Text = "Invalid Login!"
  4. Else
  5. objReader.Close() ' ||||| Close the Connections & Reader
  6. Return True
  7. End If
  8.  

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)
  1. SELECT COUNT(*) AS Num_of_User
  2. FROM USR_USER
  3. 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
Attached Files
File Type: zip gestione_pers.zip (37.3 KB, 86 views)
Reputation Points: 11
Solved Threads: 2
Newbie Poster
millers_35 is offline Offline
18 posts
since Apr 2005
May 6th, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

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:
Reputation Points: 10
Solved Threads: 1
Newbie Poster
lorf14plus is offline Offline
20 posts
since May 2005
May 8th, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

np man just trying to give back to da community. This site has helped me out alot.

Miller
Reputation Points: 11
Solved Threads: 2
Newbie Poster
millers_35 is offline Offline
18 posts
since Apr 2005
May 10th, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
phuture is offline Offline
2 posts
since May 2005
May 11th, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

Hi post the portion of code of the try-catch-finaly and if I found an error i post you the correct code.

Bye
Reputation Points: 10
Solved Threads: 1
Newbie Poster
lorf14plus is offline Offline
20 posts
since May 2005
May 11th, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

just for curiosity, but you do have the try part of the try-catch block above this code??

Have you rebuilt the project?


Quote 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
Team Colleague
Reputation Points: 211
Solved Threads: 27
Master Poster
Paladine is offline Offline
793 posts
since Feb 2003
May 12th, 2005
0

Re: Simple ASP.Net Login Page (Using VB.Net)

Thanks guys but i manage to find the problem. I imported oleDb exception and just change exception to oleDbexception and everything is fine now.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
phuture is offline Offline
2 posts
since May 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in ASP.NET Forum Timeline: ASP.Net Directory Problems
Next Thread in ASP.NET Forum Timeline: Ready to take up a challenge





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC