.NEXT算没有。连接到服务器的客户端 [英] .Next count no. clients connected to the server

查看:129
本文介绍了.NEXT算没有。连接到服务器的客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了ASP.NET与C#。我要检查有多少客户端发送请求到Web服务器。我有那么部署IIS服务器的网页时,我已经从IIS Web服务器的使用另一台计算机的IP地址访问此网站。怎么算没有。客户端连接到服务器?

i have used the ASP.NET with C# . i want to check how many client send request to the web server . i have deploy the web page in IIS server then when i have accessed this site from the another computer using IP address of the IIS web server . how to count no. clients connected to the server?

由于使用前请先

推荐答案

使用下面的函数来获取IP和日志这一点。然后采取独特的IP找出多少台计算机连接到你的服务器

use the below function to get the IP and log this. Then take the unique IP to find out how many computers connect to your server

public static string GetIPAddress()
{
    System.Web.HttpContext context = System.Web.HttpContext.Current;
    string sIPAddress = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
    if (string.IsNullOrEmpty(sIPAddress)) {
        return context.Request.ServerVariables["REMOTE_ADDR"];
    } else {
        string[] ipArray = sIPAddress.Split(new Char[] { ',' });
        return ipArray[0];
    }
}

这篇关于.NEXT算没有。连接到服务器的客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆