help with log in webform using ms access

I am trying to build a simple login form on an existing website I am getting these errors:
txtUser does not exist in the current context
txtPass does not exist in the current context
Literal1 does not exist in the current context

I will paste below first the form, then the codebehind

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="logIn.aspx.cs" Inherits="WebApplication1._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

Untitled Page

New users can register here.

Please Login


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OleDb;

namespace WebApplication1

public partial class _logIn : System.Web.UI.Page

protected void Page_Load(object sender, EventArgs e)

protected void btnLogin_Click(object sender, EventArgs e)

string connect = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\Users\Christie\Desktop\WebApplication1\App_Data\prosearchusers.mdb";
string query = "Select Count(*) From tblCustRecords Where username = '" & txtUser & "' And [password] = '" & txtPass & "'";
int result = 0;
using (OleDbConnection conn = new OleDbConnection(connect))
using (OleDbCommand cmd = new OleDbCommand(query, conn))
cmd.Parameters.AddWithValue("Cust_Name", txtUser);
cmd.Parameters.AddWithValue("Cust_Password", txtPass);
Session["User"] = txtUser;
result = (int)cmd.ExecuteScalar();
if (result > 0)
Literal1 = "Invalid login";


Can someone please help me, I really do not have much experience in .net programming
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!