•
•
•
•
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 456,273 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 3,320 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: 155973 | Replies: 74 | Solved
![]() |
•
•
Join Date: Dec 2004
Location: Washington DC
Posts: 10
Reputation:
Rep Power: 4
Solved Threads: 1
•
•
•
•
Originally Posted by Paladine
Well the SQL looks sound to me. This line of code redirects the client on successful login:
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False) ' ||||| default.aspx Page!
and if not,
Response.Redirect("Denied.aspx")
Not sure if that helps. But SQL does not affect the Redirection unless you condition statement (which I am not sure what it looks like) bypasses this redirection.
Thanks for answering Paladine!
Thats very helpful. (When one doesn't know whats wrong, one has a tendency to waste time with things that are really inconsequential.) The nature of this problem disturbs me because the application does not seem to be executing the conditional in the DBConnection function. If I leave one of the text boxes blank the validation works, however if I type in any user name and password, the page just seems to refresh. I should have mentioned that I have attempted to execute this code without using the codebehind method of programming. (I can never get it to work for me.)
I think that I will have to keep playing with it because I think that I have modified the example beyond the point where it can be recognizably assisted remotely. I will let you know what I come up with.
•
•
Join Date: Dec 2004
Location: Washington DC
Posts: 10
Reputation:
Rep Power: 4
Solved Threads: 1
•
•
•
•
Originally Posted by Javaknight
I will let you know what I come up with.
Paladine,
I finally solved the problem. :cheesy: I was not getting a response from the page because my webform button was not set up correctly. :o
This is the code that I modified from the original:
<asp:button id="cmdSubmit" text="Submit" runat="server" borderstyle="Solid" onclick="cmdSubmit_Click">
I can only assume that I had to add this onclick element because I am not using the codebehind method of programing. I'll attempt to keep this in mind in the future.
Thanks for your help!
•
•
Join Date: Jan 2005
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 1
Really good job!
Here is an idea for a little improvement in the Try block:
(Just to keep the coding happy
)
Try
If MyConn.State = ConnectionState.Closed Then
MyConn.Open()
End If
Return MyCmd.ExecuteScalar()
Catch ex As Exception
lblMessage.Text = "Error Connecting to Database!"
Finally
MyConn.Close()
End Try
Here is an idea for a little improvement in the Try block:
(Just to keep the coding happy
)Try
If MyConn.State = ConnectionState.Closed Then
MyConn.Open()
End If
Return MyCmd.ExecuteScalar()
Catch ex As Exception
lblMessage.Text = "Error Connecting to Database!"
Finally
MyConn.Close()
End Try
•
•
Join Date: Jan 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 1
Hi Paladine,
firstly thank you so much for the code coz it really helps me get started. After compiling and running the login.aspx and typed in the username - Admin / password - Admin (what is in the Northwind.mdb), it still prompt me invalid login. Why is this so?
And also, is there any way to encrypt or hide the password stored in Northwind.mdb? Because I see there's no security if anybody can just open and see the password right? Thanks in advance for the help. GREAT SITE!!
firstly thank you so much for the code coz it really helps me get started. After compiling and running the login.aspx and typed in the username - Admin / password - Admin (what is in the Northwind.mdb), it still prompt me invalid login. Why is this so?
And also, is there any way to encrypt or hide the password stored in Northwind.mdb? Because I see there's no security if anybody can just open and see the password right? Thanks in advance for the help. GREAT SITE!!
Thanks Dragtoth, glad it helps...well kind of anyway. 
Ok, have you gone through the debugging and scene what value(s) are being passed to the DB? That would be my first step. Always confirm what is being sent to the DB, you may type it correctly in the login boxes but that does not mean it is being passsed correctly to the DB.
PM me if you have the answer or that still doesn't solve it.
As for Encryption, I haven't had a chance to sit down and write the code for that, but you could use SHA1 encryption (part of the .NET environment) and there are some things you can do to mask the password in Access (i.e. Input Mask in the table design view)
Hope this helps.
I will try to sit down soon and write an encryption version of this.

Ok, have you gone through the debugging and scene what value(s) are being passed to the DB? That would be my first step. Always confirm what is being sent to the DB, you may type it correctly in the login boxes but that does not mean it is being passsed correctly to the DB.
PM me if you have the answer or that still doesn't solve it.
As for Encryption, I haven't had a chance to sit down and write the code for that, but you could use SHA1 encryption (part of the .NET environment) and there are some things you can do to mask the password in Access (i.e. Input Mask in the table design view)
Hope this helps.
I will try to sit down soon and write an encryption version of this.
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: Jan 2005
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 1
•
•
•
•
Originally Posted by Paladine
Thanks Dragtoth, glad it helps...well kind of anyway.
Ok, have you gone through the debugging and scene what value(s) are being passed to the DB? That would be my first step. Always confirm what is being sent to the DB, you may type it correctly in the login boxes but that does not mean it is being passsed correctly to the DB.
PM me if you have the answer or that still doesn't solve it.
As for Encryption, I haven't had a chance to sit down and write the code for that, but you could use SHA1 encryption (part of the .NET environment) and there are some things you can do to mask the password in Access (i.e. Input Mask in the table design view)
Hope this helps.
I will try to sit down soon and write an encryption version of this.
Hi Paladine
I am having the same trouble as the others... I have done everything as stated in the code, but still no matter what is typed in the username or password text boxes, the label states "Invalid Login" and I can't figure out why for the life of me!
Please help if you can!
Thanks in advance!
•
•
Join Date: Jan 2005
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 1
Also,
" Dim LoginSQL As String"
seems to have been declared for no further use or references throughout...
THanks
" Dim LoginSQL As String"
seems to have been declared for no further use or references throughout...
THanks
•
•
Join Date: Feb 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 1
Hi,
Maybe you can help me.
I have an existing web site done with ASP pages. Now we would like to add a login using the ASP.NET Forms method.
Is there a way to have the user redirected to the login when requesting an ASP page when he is not loged in? Maybe a cookie to check or something?
We tried to convert to ASP pages to ASPX pages but it would require redoing the web site almost entirelly and unfortunatelly this is not an option right now.
Thank you
Maybe you can help me.
I have an existing web site done with ASP pages. Now we would like to add a login using the ASP.NET Forms method.
Is there a way to have the user redirected to the login when requesting an ASP page when he is not loged in? Maybe a cookie to check or something?
We tried to convert to ASP pages to ASPX pages but it would require redoing the web site almost entirelly and unfortunatelly this is not an option right now.
Thank you
•
•
Join Date: Feb 2005
Posts: 12
Reputation:
Rep Power: 4
Solved Threads: 1
Hi everyone,
Another .net newbie in the house. Could someone please put everything together for SQL DB? I am trying to follow the instruction on Access and then change some stuffs to SQL but it didn't work. I have no clue what I was doing wrong.
Thank you so much.
-kendel
Another .net newbie in the house. Could someone please put everything together for SQL DB? I am trying to follow the instruction on Access and then change some stuffs to SQL but it didn't work. I have no clue what I was doing wrong.
Thank you so much.
-kendel
Hi folks, sorry been really busy lately. Ok, I will redo the whole thing in Access, SQL and Oracle (just in case).
So bare with me till the weekend.
Later
So bare with me till the weekend.
Later
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: 2 (0 members and 2 guests)
Other Threads in the ASP.NET Forum
- Previous Thread: ASP.Net Directory Problems
- Next Thread: Ready to take up a challenge

Linear Mode