Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6694537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:06:47+00:00 2026-05-26T06:06:47+00:00

There is a login page in aspx.net that asks the user to enter in

  • 0

There is a login page in aspx.net that asks the user to enter in their username and what authorization level they are.

My question is once they do that I have to read from that and check what they entered from a sql database with all the possible usernames and authorizations. Problem is the login page is in aspx.net and the code to check the login information is in regular .cs file.

If someone can look over my code and tell me what I am doing wrong and possibly give me a better code or fix what I have that would be great!

And sorry about the errors and confusion, I am new to coding!

Here is what I have so far:

public bool getCredentials(string UserName, string Authlvl)
    {

        bool valid = false;

        string loginSQL = "SELECT COUNT FROM user_verification WHERE userID = '" + UserName + "' AND auth_lvl = '" + Authlvl + "'";

        SqlCommand cmd = new SqlCommand(loginSQL, dB.Connect());

        try
        {
            int rowCount = Convert.ToInt32(cmd.ExecuteScalar());
            if (rowCount >= 1)
            {
                valid = true;
            }

            else if (rowCount <= 0)
            {
                valid = false;
            }
        }

        catch
        {
        }

        return valid;
    }

    public void getInfo(string _Username, string Authlvl)
    {
        string selectAllSql = "Select auth_lvl FROM user_verification WHERE userID = '" + UserName + "'AND auth_lvl = '" + Authlvl
             + "'";
        SqlCommand cmd = new SqlCommand(selectAllSql, dB.Connect());
        Authlvl = "";

        SqlDataReader reader;

        try
        {
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                UserName.Text = reader["username"].ToString();
                Authlvl.Text = reader["auth_lvl"].ToString();
            }
        }
        catch (Exception ex)
        {
            throw (new Exception("" + ex));
        }
    }

        private void Form1_Load(object sender, EventArgs e)
    {
        // TODO: This line of code loads data into the 'import_logDataSet.DB_tables' table. You can move, or remove it, as needed.
        this.dB_tablesTableAdapter.Fill(this.import_logDataSet.DB_tables);
    }

    private void button1_Click(object sender, EventArgs e)
    {
        save.ShowDialog();
    }

    private void button3_Click(object sender, EventArgs e)
    {
        //Clears all text in text box
         ID.Clear();
    }

    private void button4_Click(object sender, EventArgs e)
    {

        string str = @"";
        Process process = new Process();
        process.StartInfo.FileName = str;
        process.Start(); 
    }

    private void ID_KeyPress(object sender, KeyPressEventArgs e)
    {
        char ch = e.KeyChar;
        if (!Char.IsDigit(ch) && ch != 8 && ch != 13 && e.KeyChar < 65 || e.KeyChar > 122)
        {
            e.Handled = true;
        }

        StreamWriter sw = new StreamWriter("ExporterOutput.txt");
        sw.WriteLine(ID.Text);
        sw.Close();
    }
    private void OutputBox_TextChanged(object sender, EventArgs e)
    {
        MessageBox.Show("Here is the information you input: ");
        StreamWriter sw = new StreamWriter("ExporterOutput.txt");
        sw.WriteLine(ID.Text, UserName.Text, Authlvl.Text, comboBox1.Text, comboBox2.Text, FolderDrop.Text);
        sw.Close();
    }

    private void Help_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {
        System.Diagnostics.Process.Start("http://www.google.com");
        Help.LinkVisited = true;
    }

    private void save_FileOk(object sender, CancelEventArgs e)
    {

    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:06:48+00:00Added an answer on May 26, 2026 at 6:06 am

    Assuming that UserID is a numeric field, UserID = UserName will not work.

    EDIT

    I think the problem is with your select statement. COUNT is a function and requires an argument. Try something like this instead:

    SELECT COUNT(*) FROM user_verification [rest of your query]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Coding Platform ASP.NET 4.0 WebForms I have two pages that are relevant here Login.aspx
I have a silverlight app that uses a simple Login.aspx page. I have all
Scenario : On a ASP.NET site, we have a login page (login.aspx). Within login.aspx.cs
I have this situation: There are a login page with a login form (form
I have a .NET 2005 (C#) desktop application, in which there is a login
There are some HTML based games (ie bootleggers.us) that have a simple login form
Is there an app or way to browse a directory that requires different login
I'm using ASP.Net and forms authentication. When a user is directed to the Login
I have a client running an ASP.NET application. Inside of that, there's a self-contained
I have 3 asp.net pages: Search.aspx, Results.aspx and Login.aspx. Now I want anonymous users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.