how to avoid multiple user login

Posted by Vforvijay under Regular Expressions on 1/27/2011 | Points: 10 | Views : 5254 | Status : [Member] | Replies : 13
hi how to avoid the same user multiple login in web page ........
use the link...... HTTP://VBDOTNETADDICT.BLOGSPOT.COM




Responses

Posted by: Prabhakar on: 1/27/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Vforvijay

it is gud for multiple user login. why u r avoiding multiple user login.

Thanks & Regard's
Prabhakar

Best Regard's
Prabhakar

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 1/27/2011 [Member] Starter | Points: 25

Up
0
Down
is there any other steps to avoid the same user login

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 1/27/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Vforvijay


yeh create checkuser funtion and now check in function same user in entered in ur data base
or not .

public Boolean checkBranch()
{
string constr1;
constr1 = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
con = new SqlConnection(constr1);
con.Open();
string sql = "select * from usermaster where user='" + Txtusername.Text + "' and [Pwd]='"+ Txtpassword.Text +'" + ddlsession.SelectedItem.Text + "'";
cmd = new SqlCommand(sql, con);
rd = cmd.ExecuteReader();
if (rd.Read())
{
return true;
}
else
{
return false;
}

Best Regard's
Prabhakar

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 1/27/2011 [Member] Starter | Points: 25

Up
0
Down
hi prabhkar .
sorry i didnt get your point.....

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 1/27/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
hi


means ,,, i say u check user not double inset in ur data base so you create function & then simple in ur data base not duplicate user ... so you to avoid the same user login ...


Thanks & Ragard's
Prabhakar


Best Regard's
Prabhakar

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 1/27/2011 [Member] Starter | Points: 25

Up
0
Down
hi...
you are right ... BUT suppose the user is not promptly log out..i.e user directly close the browser close button means ..how the data will be change....

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 1/27/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
IF user are closed the page click on close button so no problem because.. session is automatically finish .. Cookies are clear .

it's not problem to at all .

Thanks
Prabhakar


Best Regard's
Prabhakar

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/27/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

You can avoid using multiple login by checking if the user is already logged in or not by keep an indicator in session or cookies to see if the user is logged in or logged out so that we can avoid multiple login

Thanks
Karthik
www.f5Debug.net

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 1/27/2011 [Member] Starter | Points: 25

Up
0
Down
bu the database table will not change....in your coding your checking the database table user name and password......when the user logout the database have to become empty then only the user can able to login again .....

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/27/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
If your site is visited by n number of users and its difficult to maintain in the sql server db for all the logins and logouts. if you not going to track out and only if you want to avoid multiple logins then its shld be the better option to use sessions to see if the user is logged in already. Else u can use cookies as well... since this is not sensitive data

Thanks
Karthik
www.f5Debug.net

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 1/27/2011 [Member] Starter | Points: 25

Up
0
Down
hi karthik...

can u plz send the code for session,if the user using different browser means , session method will not work out.....suppose the user access from different place means how can we control the user login......

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/27/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
ok if session fails u can very well use the cookie... save only an indicator to see if the user logs in or not

Thanks
Karthik
www.f5Debug.net

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Spsh on: 7/20/2011 [Member] Starter | Points: 25

Up
0
Down
Dear VforVijay

Kindly refer the below link. It will very useful and will give the solution for u. Thanks.

http://spshdotnet.blogspot.com/2011/01/how-to-prevent-mulituser-login-in.html

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response