|
-
Nov 19th, 2002, 01:42 PM
#1
Thread Starter
Fanatic Member
Login Web page using Database/VB.net
I am desperate to find an example of webforms authentication using Vb.net/asp.net.
The examples I have found so far are all in C# require xml or are confusing.
Can anyone help?
I used to do this type of thing in my sleep in good old asp.
Thanks in advance
-
Nov 19th, 2002, 02:18 PM
#2
You set the following info up in the web.config file:
<authentication mode="Forms">
<forms>
<credentials passwordFormat="Clear">
<user name="JohnDoe" password="RemoteDoe" />
<user name="JaneDoe" password="CookieDough" />
</credentials>
</forms>
</authentication>
Then add a webform and name it login.aspx with the normal login bit and here is how to test for authentication and redirect to the page they where headed to.
VB Code:
Private Sub btnLogon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogon.Click
If FormsAuthentication.Authenticate(txtUsername.Text, txtPassword.Text) = True Then
FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, False)
Else
lblInfo.Text = "Logon Failed - Please Try Again!"
End If
End Sub
That should get you started. There are numerous different variations you could throw in, like encryption on the password, persisting the user info in a cookie, get the list of users from another source (although I haven't done this one before).
-
Nov 19th, 2002, 03:27 PM
#3
Thread Starter
Fanatic Member
I'm sorry Edneeis but I dont think I made myself clear.
I need to draw the information from an sql server database.
Cheers
-
Nov 19th, 2002, 03:46 PM
#4
Sorry haven't had to do that yet, but if you have a link that is in C# I could translate it. Post me some links please.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|