I'm trying to use the login features with an sql server 2000 db. So far it hasn't been a pleasant ride. Before I go on trying - does anyone know if they are compatible at all?
Private Function SiteLevelCustomAuthenticationMethod(ByVal UserName
As String,
ByVal Password
As String)
As Boolean
Dim boolReturnValue
As Boolean =
False
Dim strConnection
As String =
"Data Source=sql.bjorn.se;Initial Catalog=db0544;Persist Security Info=True;User ID=du0457;Password=Khgfh5hgf"
Dim Connection As SqlConnection =
New SqlConnection(strConnection)
Dim strSQL As
String = "Select * From Main"
Dim command As SqlCommand =
New SqlCommand(strSQL, Connection)
Dim Dr As SqlDataReader
Connection.Open()
Dr = command.ExecuteReader
While Dr.Read
If ((UserName = Dr("user").ToString) _
And (Password = Dr("pwd").ToString))
Then
boolReturnValue = True
End If
Dr.Close()
Return boolReturnValue
End While
End Function
End Class
I hope I brought something back to the community this way.
Now a question again - one's down, there are many to go, I guess; Login is fixed but the other login-related controls must have similar code, won't they? What about the code for, say, a CreateUserWizard control? If you can point me in the right direction,
I'd be grateful. Otherwise, thanks for your kind help so far.
From Sweden with love,
Pettrer
Coding is a nine-to-five job: Nine PM to Five AM.
Marked as answer by Iori_Jay on Oct 24, 2006 03:47 AM
I'm working on the CreateUserWizard now and I think I got it working somewhat (will post it when it's ready for others) but I have a strange problem - I don't seem to be able to write to the db, and still get no error message! Ideas perhaps?
You've got an interesting blog, by the way! I agree with you on Telerik's superiority, but as far as ajax goes, atlas does the job + it's free... Sorry to be OT.
Actually Telerik wraps around Atlas enginee but with their controls, and those controls are very poweful, the combobox is the best control out there, still uses Atlas.
Atlas is great, but the controls are pretty poor, only use atlas as the UpdatePanel do not use extenders!
pettrer
Participant
970 Points
469 Posts
sql server 2000 + login features
Oct 17, 2006 05:50 PM|LINK
Hi,
I'm trying to use the login features with an sql server 2000 db. So far it hasn't been a pleasant ride. Before I go on trying - does anyone know if they are compatible at all?
Thnx,
Pettrer
albertpascua...
All-Star
17520 Points
3475 Posts
MVP
Re: sql server 2000 + login features
Oct 17, 2006 08:17 PM|LINK
Easy way: Click Website/ASP.NET Configuration. Will do the work for you
Al
My Blog
pettrer
Participant
970 Points
469 Posts
Re: sql server 2000 + login features
Oct 17, 2006 08:31 PM|LINK
Yes, thanks, but what I'm asking is: Does Sql Server 200 work with WVD Express and asp.net 2.0 or do I need Sql Server 2005 for anything in specific?
Thanks for your reply,
Pettrer
albertpascua...
All-Star
17520 Points
3475 Posts
MVP
Re: sql server 2000 + login features
Oct 17, 2006 09:03 PM|LINK
Al
My Blog
pettrer
Participant
970 Points
469 Posts
Re: sql server 2000 + login features
Oct 17, 2006 09:30 PM|LINK
Hi there,
Minutes ago, I actually could see that for myself, for the very first time!!![:D]
I simply used the code from here http://www.c-sharpcorner.com/UploadFile/sushmita_kumari/Logincontrol101312006002845AM/Logincontrol1.aspx?ArticleID=c33d0072-8f7c-4958-a7dc-ca1809737193 - which provides the code for a login control using a table of one's own. I made a VB version of it - here it is in case someone wants it (passwords etc altered of course):
This is the complete aspx file:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Login.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="Form1" runat="server">
<div>
<asp:Login ID="Login1" runat="server">
</asp:Login>
</div>
</form>
</body>
</html>
This is the complete codebehind file:
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
Dim Authenticated As Boolean = False
Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password)
e.Authenticated = Authenticated
If (Authenticated = True) Then
Response.Redirect("Home.aspx")
End If
End Sub
Private Function SiteLevelCustomAuthenticationMethod(ByVal UserName As String, ByVal Password As String) As Boolean
Dim boolReturnValue As Boolean = False
Dim strConnection As String = "Data Source=sql.bjorn.se;Initial Catalog=db0544;Persist Security Info=True;User ID=du0457;Password=Khgfh5hgf"
Dim Connection As SqlConnection = New SqlConnection(strConnection)
Dim strSQL As String = "Select * From Main"
Dim command As SqlCommand = New SqlCommand(strSQL, Connection)
Dim Dr As SqlDataReader
Connection.Open()
Dr = command.ExecuteReader
While Dr.Read
If ((UserName = Dr("user").ToString) _
And (Password = Dr("pwd").ToString)) Then
boolReturnValue = True
End If
Dr.Close()
Return boolReturnValue
End While
End Function
End Class
I hope I brought something back to the community this way.
Now a question again - one's down, there are many to go, I guess; Login is fixed but the other login-related controls must have similar code, won't they? What about the code for, say, a CreateUserWizard control? If you can point me in the right direction, I'd be grateful. Otherwise, thanks for your kind help so far.
From Sweden with love,
Pettrer
albertpascua...
All-Star
17520 Points
3475 Posts
MVP
Re: sql server 2000 + login features
Oct 17, 2006 09:44 PM|LINK
You'll find them all on the toolbar under LOGIN CONTROLS, drag and drop. If Login is:
<asp:Login ID="Login1" runat="server">
Others
<asp:CreateUserWizard
Al
My Blog
pettrer
Participant
970 Points
469 Posts
Re: sql server 2000 + login features
Oct 17, 2006 10:32 PM|LINK
Hi again,
I seem to not make myself very clear tonight. :-)
What I meant was that I need to create the codebehind stuff coding for the rest of the login controls...
P
pettrer
Participant
970 Points
469 Posts
Re: sql server 2000 + login features
Oct 17, 2006 10:40 PM|LINK
I'm working on the CreateUserWizard now and I think I got it working somewhat (will post it when it's ready for others) but I have a strange problem - I don't seem to be able to write to the db, and still get no error message! Ideas perhaps?
Here's the thread describing it: http://forums.asp.net/thread/1431692.aspx
Thnx!
Pettrer
pettrer
Participant
970 Points
469 Posts
Re: sql server 2000 + login features
Oct 17, 2006 11:38 PM|LINK
You've got an interesting blog, by the way! I agree with you on Telerik's superiority, but as far as ajax goes, atlas does the job + it's free... Sorry to be OT.
P
albertpascua...
All-Star
17520 Points
3475 Posts
MVP
Re: sql server 2000 + login features
Oct 18, 2006 05:15 AM|LINK
Actually Telerik wraps around Atlas enginee but with their controls, and those controls are very poweful, the combobox is the best control out there, still uses Atlas.
Atlas is great, but the controls are pretty poor, only use atlas as the UpdatePanel do not use extenders!
Al
My Blog