asp.net login verifier using the ODP-Oracle connection method

Source: Internet
Author: User
Tags bool oracleconnection regular expression

This article mainly introduces the asp.net using the ODP-Oracle connection method of the anti-injection login verification program, the need for friends can refer to the

There are a lot of SQL connections on the Internet login authentication, but no Oracle connection way, I groped a morning to write this executable function, share to everyone

The code is as follows:

User Login Check

public bool Logincheck (string f_loginname, String f_loginpass)

{

BOOL result = FALSE;

Regular expression checking

if (Regex.IsMatch (f_loginname,@ "^[a-za-z0-9]{1,15}$") && Regex.IsMatch (f_loginpass,@ "^[a-za-z0-9]{1,15}$" ))

{

OracleConnection objconn = new OracleConnection (configurationmanager.connectionstrings["ConnectionString"). ConnectionString);

OracleCommand objcmd = new OracleCommand ("SELECT * from USERS where username=:p username and password=:p password", objconn) ;

OBJCMD.PARAMETERS.ADD ("Pusername", oracledbtype.varchar2). Value = F_loginname;

OBJCMD.PARAMETERS.ADD ("Ppassword", oracledbtype.varchar2). Value = F_loginpass;

objConn.Open ();

OracleDataReader OBJDR = Objcmd.executereader ();

Read content

if (Objdr.read ())

{

result = true;

}

Close Database

Objdr.close ();

Objconn.close ();

}

return result;

}

Note : Please pay attention to the triple Programming Tutorials section for more wonderful articles .

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.