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

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

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

 
0
  #61
May 3rd, 2005
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.


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, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Quick reply to this message  
Join Date: May 2005
Posts: 20
Reputation: lorf14plus is an unknown quantity at this point 
Solved Threads: 1
lorf14plus lorf14plus is offline Offline
Newbie Poster

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

 
0
  #62
May 4th, 2005
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, 72 views)
Quick reply to this message  
Join Date: May 2005
Posts: 20
Reputation: lorf14plus is an unknown quantity at this point 
Solved Threads: 1
lorf14plus lorf14plus is offline Offline
Newbie Poster

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

 
0
  #63
May 4th, 2005
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
Quick reply to this message  
Join Date: Apr 2005
Posts: 18
Reputation: millers_35 is an unknown quantity at this point 
Solved Threads: 2
millers_35 millers_35 is offline Offline
Newbie Poster

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

 
0
  #64
May 5th, 2005
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
  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"
  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:

  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, 41 views)
Quick reply to this message  
Join Date: May 2005
Posts: 20
Reputation: lorf14plus is an unknown quantity at this point 
Solved Threads: 1
lorf14plus lorf14plus is offline Offline
Newbie Poster

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

 
0
  #65
May 6th, 2005
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:
Quick reply to this message  
Join Date: Apr 2005
Posts: 18
Reputation: millers_35 is an unknown quantity at this point 
Solved Threads: 2
millers_35 millers_35 is offline Offline
Newbie Poster

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

 
0
  #66
May 8th, 2005
np man just trying to give back to da community. This site has helped me out alot.

Miller
Quick reply to this message  
Join Date: May 2005
Posts: 2
Reputation: phuture is an unknown quantity at this point 
Solved Threads: 1
phuture phuture is offline Offline
Newbie Poster

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

 
0
  #67
May 10th, 2005
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
Quick reply to this message  
Join Date: May 2005
Posts: 20
Reputation: lorf14plus is an unknown quantity at this point 
Solved Threads: 1
lorf14plus lorf14plus is offline Offline
Newbie Poster

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

 
0
  #68
May 11th, 2005
Hi post the portion of code of the try-catch-finaly and if I found an error i post you the correct code.

Bye
Quick reply to this message  
Join Date: Feb 2003
Posts: 793
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Solved Threads: 26
Team Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

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

 
0
  #69
May 11th, 2005
just for curiosity, but you do have the try part of the try-catch block above this code??

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, Pharmacy Informatics
Wordpress Learning Blog
Updated : ASP.Net Login Code
Quick reply to this message  
Join Date: May 2005
Posts: 2
Reputation: phuture is an unknown quantity at this point 
Solved Threads: 1
phuture phuture is offline Offline
Newbie Poster

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

 
0
  #70
May 12th, 2005
Thanks guys but i manage to find the problem. I imported oleDb exception and just change exception to oleDbexception and everything is fine now.
Quick reply to this message  
Closed Thread

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC