限制每台PC的开放连接. [英] Limit open connection per pc.
本文介绍了限制每台PC的开放连接.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
伙计们,
如何验证网站是否已打开.
我想限制每台PC与我的网站的连接.
如果我的网站已经在用户的PC中打开,然后尝试从另一个浏览器再次打开它,那么我只想关注当前打开的浏览器.
谢谢,
Hernan Cabrera
Guys,
How can I validate if website is already open.
I want to limit connection to my website per pc.
If my website is already open in the user''s pc and try to open it again from another browser then I want to just focus to the currently open browser.
Thanks,
Hernan Cabrera
推荐答案
一个选择是在数据库SQLite或类似模型中注册访问者.您可以检查IP地址:
http://stackoverflow.com/questions/735350/how-to-get-a-users-client-client-ip-address-in-asp-net [ http://stackoverflow.com/questions/6160991/how-to-get-client-machine-name-in-asp-net-c-sharp [使用ASP.NET和C#检测浏览器 [ ^ ]
如果这两个不起作用,我真的不知道您应该怎么做.我真的不明白这是什么意思....
顺便说一句:Mac地址更加麻烦:
如何获取客户端计算机的Mac地址在asp.net [ ^ ]
One choise is to register the visitors in a database SQLite or something simular. You could check the IP adress:
http://stackoverflow.com/questions/735350/how-to-get-a-users-client-ip-address-in-asp-net[^]
and/or the host name:
http://stackoverflow.com/questions/6160991/how-to-get-client-machine-name-in-asp-net-c-sharp[^]
Get the browser:
Detect the browser using ASP.NET and C#[^]
If those two dosnt work I dont really know what you should do. I dont really see what the point is though....
BTW: Mac Adress it more troublesome:
How to get Mac Address of Client Machine in asp.net[^]
您好,
更好的方法是在客户端上创建Cookie,并每次检查Cookie.请参阅以下代码段.
Hello,
Better approach is to create Cookies on clients, And check cookie every time. Refer following code snippet.
public bool IsInstanceAlreadyExist()
{
if (null == System.Web.HttpContext.Current.Request.Cookies["InstanceExist"])
{
HttpCookie myCookie = new HttpCookie("InstanceExist")
// Set the cookie value.
myCookie.Value = "True";
// Add the cookie.
System.Web.HttpContext.Current.Response.Cookies.Add(myCookie);
return false;
}
else
{
return true;
}
}
并清除Session上的cookie以处理浏览器关闭问题.
And clear the cookie on Session to handle browser close issues.
void Session_End(object sender, EventArgs e)
{
}
谢谢!!!!
Thanks!!!!
肯尼思和维诺德,
我尝试使用global.asax中的变量及其现在的功能.
对于每个登录的用户,我将其连接到global.asax中的变量,但在
之前 我使用instr验证用户是否在变量中.
感谢你们俩.
埃尔南·卡布雷拉(Hernan Cabrera)
Hi Kenneth and Vinod,
I''ve tried to use variable from global.asax and its working now.
for each user that login, I concatenate to a variable from global.asax but before
that I use instr to validate if the user is in the variable.
thanks to both of you.
Hernan Cabrera
这篇关于限制每台PC的开放连接.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文