User Name Password Register
DaniWeb IT Discussion Community
All
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 392,051 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 4,288 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: 138636 | Replies: 145
Reply
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 26
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Updated : Simple ASP.Net Login Page

  #51  
Jul 19th, 2005
Yup, I have a pretty good idea what is wrong. You say you get no build errors? Hmm, because here is what the problem is:

SqlCommand cmd = new SqlCommand("proc_ValidateUser", conn);

You pass in conn for the connection string, but no where in your code do you either declare conn or pass a value for it to retain?

So that is why it just refreshes right back to the Login page.

Hope this helps.

Great code, nice layout, clean, and logical. Well done!

Thanks for the compliments!
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Jul 2005
Posts: 2
Reputation: Assimalyst is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Assimalyst Assimalyst is offline Offline
Newbie Poster

Re: Updated : Simple ASP.Net Login Page

  #52  
Jul 19th, 2005
Thanks again Paladine, you must be some sort of other worldly genius!! I've got it working!! :cheesy:

Your time and efforts on these forums is much appreciated.
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 26
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Updated : Simple ASP.Net Login Page

  #53  
Jul 19th, 2005
:o

Well thanks for the compliments. Glad it worked out.

I enjoying helping everyone here, just glad to see people are using my tutorials. That is enough of a compliment.

Take care....Happy Coding

Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Jun 2005
Posts: 3
Reputation: Sundown is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Sundown Sundown is offline Offline
Newbie Poster

Re: Updated : Simple ASP.Net Login Page

  #54  
Jul 19th, 2005
I'm no Expert by any means . I am just a beginner at asp.net and very willing to learn by other can anyone tell why i get this error. I though I followed the instruction correctly and it is a very good tutorial Paladine thanks.



Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
login.frmlogin.DBConnection(String strUserName, String strPassword) +473
login.frmlogin.cmdSubmit_Click(Object sender, EventArgs e) +115
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292




Unhandled Execution Error
Object reference not set to an instance of an object.
at login.frmlogin.DBConnection(String strUserName, String strPassword)
at login.frmlogin.cmdSubmit_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain()

Thanks for the help in advance
Attached Files
File Type: zip code.zip (21.9 KB, 27 views)
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 26
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: Updated : Simple ASP.Net Login Page

  #55  
Jul 19th, 2005
Well I find that interesting. I used your exact code, with only a minor change (debug="true"" in the web.config file) and it ran perfectly fine.


Have you tried setting the debug mode to true and not false? Try rebuilding the solution, before running the application.


Sorry I can't be of more help, but the code runs fine for me.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Jun 2005
Posts: 3
Reputation: Sundown is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Sundown Sundown is offline Offline
Newbie Poster

Re: Updated : Simple ASP.Net Login Page

  #56  
Jul 20th, 2005
Thanks for looking at the code for me. I will keep troubleshooting my setup
Reply With Quote  
Join Date: Aug 2005
Posts: 6
Reputation: japelweb is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
japelweb japelweb is offline Offline
Newbie Poster

4 hours and My Access MDB file hates me...

  #57  
Aug 13th, 2005
First I am new to coding and db but working hard at learning.

The login page comes up fine and no bugs in the build bet...

In the below code I keep getting an exception error??? I have checked that the MDB and LDB files have R/W for the asp.net user but no luck.

The Error connecting to DB keeps comming up and the username and password are correct.

IIS 5.1
Access DB 2003
VS 2003

Any ideas would be great as the rest seems to be fine....

Thanks Heaps

' ||||| Create OleDb Data Reader
Dim objReader As OleDbDataReader
objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)
' ||||| Close the Reader and the Connection Closes with it

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
End While
Catch ex As Exception
'lblMessage.Text = "Error Connecting to Database!"
Label1.Text = "Error Connecting to Database!"
End Try
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 26
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: 4 hours and My Access MDB file hates me...

  #58  
Aug 13th, 2005
Well, I need to ask what the error message says. If you could please provide that (more than saying an exception error), I think we can determine what the problem is.

What are the error message details.


Originally Posted by japelweb
First I am new to coding and db but working hard at learning.

The login page comes up fine and no bugs in the build bet...

In the below code I keep getting an exception error??? I have checked that the MDB and LDB files have R/W for the asp.net user but no luck.

The Error connecting to DB keeps comming up and the username and password are correct.

IIS 5.1
Access DB 2003
VS 2003

Any ideas would be great as the rest seems to be fine....

Thanks Heaps

' ||||| Create OleDb Data Reader
Dim objReader As OleDbDataReader
objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)
' ||||| Close the Reader and the Connection Closes with it

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
End While
Catch ex As Exception
'lblMessage.Text = "Error Connecting to Database!"
Label1.Text = "Error Connecting to Database!"
End Try
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Aug 2005
Posts: 6
Reputation: japelweb is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
japelweb japelweb is offline Offline
Newbie Poster

Re: Updated : Simple ASP.Net Login Page

  #59  
Aug 13th, 2005
Originally Posted by Kendel
It's my bad. I didn't know that the params in the SP must match the params in .net page

Your example works perfect. Thanks again.
I'm having the same problem can you explain further I am a newbie
Reply With Quote  
Join Date: Aug 2005
Posts: 6
Reputation: japelweb is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
japelweb japelweb is offline Offline
Newbie Poster

Re: 4 hours and My Access MDB file hates me...

  #60  
Aug 13th, 2005
Originally Posted by Paladine
Well, I need to ask what the error message says. If you could please provide that (more than saying an exception error), I think we can determine what the problem is.

What are the error message details.

I created a second lable box and sent ex to string and this was the result.

I am also building the SQL version to see how that goes.

Thanks for the help, am learning lots on this one...

System.Data.OleDb.OleDbException: Too few parameters. Expected 4. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at WebListSite.WebForm1.DBConnection(String strUserName, String strPassword) in C:\Documents and Settings\Jason Apel\My Documents\My Webs\WebListSite\AdminLogin.aspx.vb:line 89
Attached Files
File Type: zip WebListSite.zip (33.9 KB, 25 views)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 11:34 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC