0

Hey Guys,

I'm developing window based software application in c# in which I need to give login process with user privilages for different forms.

can anybody tell how is the login process implemented for window based applications in .net? and what abt user privilages?

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by LizR
0

Hey Guys,

I'm developing window based software application in c# in which I need to give login process with user privilages for different forms.

can anybody tell how is the login process implemented for window based applications in .net? and what abt user privilages?

Hi,

You have to implement this using textboxes. To give user privelages to specific forms u have to pass the values of the userid and password and check these values in particular forms. I hope u r storing these values in a table.

0

Okie,

You mean I check textbox values with database column values (just like we do in web development) and if match found then ultimately login is successfull, else it is not. Following is code I've written.....

public bool LoginProcess(string username, string password)
{
bool flag = false;
int cnt = 0;
getcon.openconnection();
getcon.con.Open();
getcon.cmd = new SqlCommand("select count(*) from admin_master where username='" + username + "' and password='" + password + "'", getcon.con);
cnt = Convert.ToInt16(getcon.cmd.ExecuteScalar());
if (cnt == 1)
{
flag = true;
}
else
{
flag = false;
}
return flag;
}

But one more issue is SQL injection.

If I go for such plain login process then I may suffer by SQL injection.

I'm lil confused about this. Plz help.

Edited by happygeek: fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.