hi,
there .i am coming up with a login page authentication, however i am getting this error that says 'Type SQl.Data.SqlClient.SqlDataReadercon1 is not defined '
[B]Dim reader As System.Data.SqlClient.SqlDataReadercon1 [/B]
<%@ Page Language="VB" MasterPageFile="~/CouierMasterPage.master" Title="Untitled Page" %>
<%@ Import Namespace="System.Data.OleDB" %>
<%@ Import Namespace="System.ComponentModel" %>
<%@ import namespace="system.web.security" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data.SqlClient.SqlException" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Web" %>
<script runat="server">
Sub OnLoginError(ByVal sender As Object, ByVal e As EventArgs)
Login1.PasswordRecoveryText = "Forgot your password?"
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Session("Check") <> Nothing) And Convert.ToBoolean(Session("Check")) Then
If (User.Identity.IsAuthenticated) Then
Response.Redirect("f_main.aspx")
End If
End If
End Sub
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
Dim blnResult As Boolean = False
blnResult = SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password)
If (blnResult) Then
Session("Check") = True
e.Authenticated = True
Else
Session("Check") = False
e.Authenticated = False
End If
End Sub
Protected Function SiteSpecificAuthenticationMethod(ByVal UserName As String, ByVal Password As String) As Boolean
Dim log_statement As String = "SELECT * FROM [user] where username='" & UserName & "' and password='" & Password & "'"
Dim con2 As System.Data.SqlClient.SqlCommand
Dim con1 As System.Data.SqlClient.SqlConnection
Dim reader As System.Data.SqlClient.SqlDataReadercon1 = New System.Data.SqlClient.SqlConnection(SqlDataSource1.ConnectionString)
con1.Open()
con2 = New System.Data.SqlClient.SqlCommand(log_statement, con1)
reader = con2.ExecuteReader()
If reader.Read Then
Return True
Else
Return False
End If
End Function
Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CourierSystemConnectionString %>"
InsertCommand="Select_Login"
InsertCommandType="StoredProcedure"
SelectCommand="SELECT UserID, Password FROM StaffRegis_Table where ((UserID=@UserID) AND (Password=@Password))">
<SelectParameters>
<asp:CookieParameter CookieName="UserID" DefaultValue="User ID"
Name="USerID" />
<asp:CookieParameter CookieName="Password" DefaultValue="Password"
Name="Password" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="UserID" Type="String" />
<asp:Parameter Name="password" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:Login ID="Login1" runat="server" CreateUserUrl="~/PasswordRecover.aspx" CreateUserText="Forgot your password?"
Height="58px" BackColor="#F7F7DE" BorderColor="#CCCC99" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt" OnAuthenticate="Login1_Authenticate">
<TitleTextStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<LayoutTemplate>
<table border="0" cellpadding="1" cellspacing="0" style="border-collapse: collapse;
height: 150px; width: 244px;">
<tr>
<td>
<table border="0" cellpadding="0" style="height: 58px">
<tr>
<td align="center" colspan="2" style="font-weight: bold; color: white; background-color: #6b696b">
Log In</td>
<td align="center" colspan="1" style="font-weight: bold; color: white; background-color: #6b696b">
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label></td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
<td>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label></td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password" Height="22px"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="2">
<asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." />
</td>
<td colspan="1">
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color: red">
<br />
<asp:LinkButton ID="LbTNPassword" runat="server"
PostBackUrl="~/PasswordRecover.aspx">Forgot your password?</asp:LinkButton>
<br />
<br />
<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/StaffRegis.aspx">Create
an account</asp:LinkButton>
<br />
<br />
</td>
<td align="center" colspan="1" style="color: red">
</td>
</tr>
<tr>
<td align="right" colspan="2">
<br />
<br />
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In"
ValidationGroup="Login1" PostBackUrl="~/Transactions.aspx"
onclick="LoginButton_Click" />
</td>
<td align="right" colspan="1">
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>
</asp:Content>