using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Management; namespace Libraries { /// /// كلاس مانيتورينگ كاربر /// Developed By Amir Ghasemi /// /// /// Version 1.0.5 /// public static class Tracking { /// /// متد برگرداندن آي پي كاربر /// /// public static string UserIP() { string strUserHostAddress = string.Empty; try { //strUserHostAddress = System.Web.HttpContext.Current.Request.UserHostAddress; strUserHostAddress = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (strUserHostAddress == null) { strUserHostAddress = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } } catch (Exception ex) { throw ex; } return (strUserHostAddress); } /// /// متد برگرداندن صفحه جاري كاربر /// /// public static string UserURL() { string strAbsoluteUri = string.Empty; strAbsoluteUri = System.Web.HttpContext.Current.Request.Url.AbsoluteUri; return (strAbsoluteUri); } /// /// تعيين صفحه قبلي كاربر /// /// public static string UserReferer() { string strHttpReferer = string.Empty; strHttpReferer = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_REFERER"]; return (strHttpReferer); } /// /// مشخصات مرورگر كاربر /// /// public static string UserBrowser() { string strBrowserName = string.Empty; string strBrowserVersion = string.Empty; string strResult = string.Empty; try { System.Web.HttpBrowserCapabilities Browse = System.Web.HttpContext.Current.Request.Browser; strBrowserName = Browse.Browser; strBrowserVersion = Browse.Version; strResult = strBrowserName + " " + strBrowserVersion; } catch (Exception ex) { throw ex; } return (strResult); } /// /// تعيين نام سيستم عامل كاربر /// /// public static string UserOs() { string strResult = string.Empty; try { System.Web.HttpBrowserCapabilities myBrowser = System.Web.HttpContext.Current.Request.Browser; strResult = myBrowser.Platform; } catch (Exception ex) { throw ex; } return (strResult); } /// /// تعيين نام ماشين كاربر /// /// public static string UserMachineName() { string strResult = string.Empty; try { strResult = System.Net.Dns.GetHostName(); } catch (Exception ex) { throw ex; } return (strResult); } } }