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?

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.

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.

then check your character types before you let them submit.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.