473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

customvalidator for checking loginanme & password

5
// this is a custom validator control tocheck username or password is correct or not
protected void CVC_ServerValidate(object source, ServerValidateEventArgs args)
{
string idsession = Session["tree_id"].ToString();

SqlConnection mysql = new SqlConnection(ConfigurationManager.ConnectionStrin gs["laxmi"].ConnectionString);
mysql.Open();
string sqlqry = "Select * from laxmivarsha.Account_Master where Account_ID = '" + txtaccountid.Text + "' And " +
" password = '" + txtpassword.Text + " ' and Flag = 'A' and Tree_id = '" + idsession + "' ";

SqlCommand sqlcmd = new SqlCommand();
sqlcmd.Connection = mysql;
sqlcmd.CommandText = sqlqry;
sqlcmd.CommandType = CommandType.Text;
SqlDataReader userdr = sqlcmd.ExecuteReader();

userdr.Read();
if (userdr.HasRows == true)
{

userdr.Close();

args.IsValid = true;
}
else
{
args.IsValid = false;
Response.Redirect("Invaliduser.aspx");
}


from mahendra - india

email : mahendra.developer@yahoo.com
Oct 14 '08 #1
1 1182
mktita
5
// this is a custom validator control tocheck username or password is correct or not from database

protected void CVC_ServerValidate(object source, ServerValidateEventArgs args)
{
string idsession = Session["tree_id"].ToString();

SqlConnection mysql = new SqlConnection(ConfigurationManager.ConnectionStrin gs["laxmi"].ConnectionString);
mysql.Open();
string sqlqry = "Select * from laxmivarsha.Account_Master where Account_ID = '" + txtaccountid.Text + "' And " +
" password = '" + txtpassword.Text + " ' and Flag = 'A' and Tree_id = '" + idsession + "' ";

SqlCommand sqlcmd = new SqlCommand();
sqlcmd.Connection = mysql;
sqlcmd.CommandText = sqlqry;
sqlcmd.CommandType = CommandType.Text;
SqlDataReader userdr = sqlcmd.ExecuteReader();

userdr.Read();
if (userdr.HasRows == true)
{

userdr.Close();

args.IsValid = true;
}
else
{
args.IsValid = false;
Response.Redirect("Invaliduser.aspx");
}


from mahendra - india

email : mahendra.developer@yahoo.com
Oct 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Philip D Heady | last post by:
Hi, I'm validating a simple form for input via post ($PHP_SELF). Near the end I check for username and password. I'm using simple if, elseif, else statements. I require them to enter password...
3
by: Ronan Dodworth | last post by:
Hi there I'm having a little bit of a problem with my customvalidator control. The problem is the javascript runs fine on my local webserver IIS but not when I post it to the web hosting server....
1
by: SMG | last post by:
Hi All. My forms has two textboxes, 1 username, 2 password. Both has requiredfield validator it works fine when there is no input in these textboxes. And the errorMsg is shown in...
1
by: cemcat | last post by:
Hello, We have an ASP.NET 2.0 (C#) web form that contains a textbox for users to enter multiple e-mail addresses separated by semicolons. We need to validate that each individual e-mail address...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.