I am trying to test form authentication in asp.net using xml file but I got this error
"Syntax error: Missing operand after @farid operator.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SyntaxErrorException: Syntax error: Missing operand after @farid operator.
Source Error:
Line 36: Users = ds.tables(0)
Line 37: Dim Matches() as DataRow
Line 38: Matches = Users.Select(cmd)
Line 39: If Matches.length >0 Then
Line 40: Dim row as DataRow
Source File: c:\inetpub\wwwroot\asp\login.aspx Line: 38
"
the login.aspx page code
"Syntax error: Missing operand after @farid operator.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SyntaxErrorException: Syntax error: Missing operand after @farid operator.
Source Error:
Line 36: Users = ds.tables(0)
Line 37: Dim Matches() as DataRow
Line 38: Matches = Users.Select(cmd)
Line 39: If Matches.length >0 Then
Line 40: Dim row as DataRow
Source File: c:\inetpub\wwwroot\asp\login.aspx Line: 38
"
the login.aspx page code
Code:
<%@ Import Namespace="System.XML" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data.OleDB" %>
<%@ Import Namespace="System.Data" %>
<%@ Page Language="vb" debug="True"%>
<HTML>
<HEAD>
<TITLE>Session 13 Cookie Authentication </TITLE>
<SCRIPT LANGUAGE="VB" RUNAT="Server">
Sub btnLogin_Click(ByVal Sender As Object, ByVal E As EventArgs)
Select Case ValidateUserXML(txtusername.text,txtpassword.text)
Case "Success"
FormsAuthentication.RedirectFromLoginPage (txtusername.text,chkPersistForms.Checked)
Case "PasswordFailed"
lblMessage.Text = "Sorry your password verification for the user " & txtusername.text &" failed."
Case "NoSuchUser"
Response.Redirect("adduser/adduser.aspx?username=" & txtusername.text)
End Select
End Sub
Sub btnAddNewUser_Click(ByVal Sender As Object, ByVal E As EventArgs)
Response.Redirect("adduser/adduser.aspx?username=Enter User Name")
End Sub
Function ValidateUserXML(ByVal username as String, ByVal password as String) as String
Dim cmd as String
cmd = "UserEmail=
Last edited by a moderator: