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 426,394 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,281 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: 2056 | Replies: 3
Reply
Join Date: Sep 2006
Posts: 17
Reputation: Dhruv Shah is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Dhruv Shah Dhruv Shah is offline Offline
Newbie Poster

Help Asp.Net Login Page Problem?

  #1  
Oct 22nd, 2006
VB.NET Code behind:
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dbconn As SqlConnection
Dim dbcommand As SqlDataAdapter
Dim dslogin As New DataSet
dbconn = New SqlConnection("Server=localhost;UID=sa;PWD=sa;database=websiteDemo")
dbconn.Open()
dbcommand = New SqlDataAdapter("Select UserID from " _
& "Login Where " _
& "Username = '" & TextBox1.Text _
& "' and Password = '" & TextBox2.Text _
& "'", dbconn)
dbcommand.Fill(dslogin, "Login")
If dslogin.Tables("Login").Rows.Count = 0 Then
Response.Write(dslogin.Tables("Login").Rows.Count = 0)
Label3.Text = "Username and Password Not Found.Please Try Again!"
Else
Session("UserID") = dslogin.Tables("Login").Rows(0).Item("UserID")
Session("Username") = TextBox1.Text
Response.Redirect("./Success.aspx")
End If
End Sub


i m getting : output as:

Username and Password Not Found.Please Try Again!"
instead i have that username in the database. Also i m inputting correct Username and Password.

Last edited by tgreer : Oct 22nd, 2006 at 4:45 pm. Reason: Ignored instructions for CODE tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2006
Posts: 17
Reputation: Dhruv Shah is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Dhruv Shah Dhruv Shah is offline Offline
Newbie Poster

Re: Asp.Net Login Page Problem?

  #2  
Oct 23rd, 2006
Sorry i m new to ASP.NET so could u explain what is CODE tags.
If it is possible for u can u modify the code i have posted such that it works correctly.
Thanks for Replying me.
Reply With Quote  
Join Date: Dec 2004
Posts: 1,590
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Asp.Net Login Page Problem?

  #3  
Oct 23rd, 2006
The forum software uses code tags for posting code. They are clearly explained in the message editor when you post a message. Just follow the instructions. Also, we use full complete standard English here, instead of the substitutions such as "i"and "u".

I don't code in VB.NET sorry. In any case, ASP.NET Authentication is a well-covered topic with thousands of tutorials on the topic available on the web. Glancing over your code, I see no obvious errors. I tend not to use DataAdapters and DataTables and all that mess. I use stored procedures. You execute them, get the response into a simple DataReader, and do what you need to do.
Reply With Quote  
Join Date: Nov 2006
Location: Nasik-India
Posts: 21
Reputation: sierrasoft is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
sierrasoft sierrasoft is offline Offline
Newbie Poster

Re: Asp.Net Login Page Problem?

  #4  
Nov 5th, 2006
Remove dbconn.Open
Reply With Quote  
Reply

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

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

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