当前位置: 首页>>代码示例>>C#>>正文


C# SessionInfo类代码示例

本文整理汇总了C#中SessionInfo的典型用法代码示例。如果您正苦于以下问题:C# SessionInfo类的具体用法?C# SessionInfo怎么用?C# SessionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SessionInfo类属于命名空间,在下文中一共展示了SessionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterClient

        public bool RegisterClient(SessionClass Session, System.Threading.Thread Thread)
        {
            int nIndex = 0;
            int nMaxClients = 0;
            nMaxClients = Int32.Parse(strMaxConnections);
            if (nMaxClients > 0 & ActiveClients >= nMaxClients)
            {
                return false;
            }
            Monitor.Enter(Client);
            for (nIndex = 0; nIndex < LastClient; nIndex++)
            {
                if (Client[nIndex].Session != null) continue;
                Client[nIndex].Session = Session;
                Client[nIndex].Thread = Thread;
                ActiveClients = ActiveClients + 1;
                SetServerStatus(ActiveClients.ToString() + " clients connected to server");
                Monitor.Exit(Client);
                return true;
            }
            Monitor.Exit(Client);
            var NewClient = new SessionInfo[LastClient + 1];
            System.Array.Copy(Client, NewClient, Math.Min(Client.Length, NewClient.Length));
            Client = NewClient;
            Client[LastClient].Session = Session;
            Client[LastClient].Thread = Thread;

            LastClient++;
            ActiveClients++;

            SetServerStatus(ActiveClients.ToString() + " clients connected to server");
            return true;
        }
开发者ID:nditz,项目名称:TMS-SERVER,代码行数:33,代码来源:frmServer.cs

示例2: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         SessionInfo info = new SessionInfo();
         if (!info.getSessionData(IsPostBack, out address, out user, out binding, out hostNameIdentifier, out configName, out hoster, out version, out platform, out hostedID))
             home(false);
         hostNameIdentifier = (string)ViewState["name"];
         configName = (string)ViewState["configname"];
         version = (string)ViewState["version"];
         platform = (string)ViewState["platform"];
         hoster = (string)ViewState["hoster"];
     }
     else
     {
         Input.getHostData(IsPostBack, ViewState, out userid, out address, out user, out binding, out hostNameIdentifier, out configName, out version, out platform, out hoster, false);
         ViewState["name"] = hostNameIdentifier;
         ViewState["configname"] = configName;
         ViewState["version"] = version;
         ViewState["platform"] = platform;
         ViewState["hoster"] = hoster;
     }
     LabelReq.Text = "Measured Page Requests";
     LabelReqDay.Text = "Measured Page Requests Per Day";
     UTC.Text = DateTime.Now.ToUniversalTime().ToString("f") + " (UTC)";
     NodeRepeater.ItemDataBound += new RepeaterItemEventHandler(NodeRepeater_ItemDataBound);
     List<ServiceNode> myNodeMap = null;
     traversePath = DynamicTraversePath.getTraversePath(hostNameIdentifier, configName, ref configProxy, address, binding, user);
     if (traversePath != null && traversePath.Count > 0)
     {
         if (traversePath[traversePath.Count - 1].MyNode.Status == ConfigSettings.MESSAGE_OFFLINE)
         {
             myNodeMap = new List<ServiceNode>();
             myNodeMap.Add(traversePath[traversePath.Count - 1].MyNode);
             if (traversePath[traversePath.Count - 1].PeerNodes != null)
                 myNodeMap.AddRange(traversePath[traversePath.Count - 1].PeerNodes);
         }
     }
     VirtualHost myVhost=null;
     if (myNodeMap == null)
     {
         myVhost = configProxy.getServiceNodeMap(hostNameIdentifier, configName, traversePath, user);
         if (myVhost == null)
             return;
         myNodeMap = myVhost.ServiceNodes;
     }
     VNODETotalReqs.Text = " (" + myVhost.TotalRequests.ToString() + ")";
     VNODETotalReqsPerDay.Text = " (" + myVhost.RequestsPerDay.ToString() + ")";
     TopNode.PostBackUrl = ConfigSettings.PAGE_NODES;
     ServiceVersion.Text = version;
     ServicePlatform.Text = platform;
     ServiceHoster.Text = hoster;
     TopNodeName.Text = hostNameIdentifier;
     NodeRepeater.DataSource = myNodeMap;
     NodeRepeater.DataBind();
     ReturnLabel.Text = "<a class=\"Return\" href=\"" + ConfigSettings.PAGE_NODES + "\">Return to Home Page</a>";
     GetImageButton.runtimePoweredBy(platform, RuntimePlatform);
 }
开发者ID:vactorwu,项目名称:catch23-project,代码行数:58,代码来源:NodeMap.aspx.cs

示例3: GetSession

 public SessionInfo GetSession()
 {
     if(this.context.Session["user_id"] != null)
     {
         SessionInfo info = new SessionInfo(this.context.Session["user_id"].ToString(), this.context.Session["first_name"].ToString(), this.context.Session["last_name"].ToString(), this.context.Session["is_moderator"].ToString(), this.context.Session["is_uploader"].ToString(), this.context.Session["is_admin"].ToString());
         return info;
     }
     else return null;
 }
开发者ID:dantomosoiu,项目名称:MusicMachine,代码行数:9,代码来源:MySession.cs

示例4: DeleteSession

 /// <summary>
 /// Delete a session for the given session info
 /// </summary>
 /// <param name="session">The session info.</param>
 public void DeleteSession(SessionInfo session)
 {
     lock (SessionsSyncLock)
     {
         if (session == null || string.IsNullOrWhiteSpace(session.SessionId)) return;
         if (m_Sessions.ContainsKey(session.SessionId) == false) return;
         m_Sessions.Remove(session.SessionId);
     }
 }
开发者ID:unosquare,项目名称:embedio,代码行数:13,代码来源:LocalSessionModule.cs

示例5: GetSession

 public SessionInfo GetSession()
 {
     SessionInfo oSession = (SessionInfo)Session[AppConfig.AdminSession];
     if (oSession == null)
     {
         oSession = new SessionInfo();
         Session[AppConfig.AdminSession] = oSession;
     }
     return oSession;
 }
开发者ID:Kjubo,项目名称:luckysign,代码行数:10,代码来源:AdminMaster.master.cs

示例6: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     Page.Form.DefaultFocus = ViewTypeHosts.ClientID;
     SessionInfo info = new SessionInfo();
     info.getSessionData(IsPostBack,out address, out user, out binding, out hostNameIdentifier, out configName, out hoster, out version, out platform, out hostedID);
     if (!(Request["version"] == "drilldown"))
         Input.getHostData(IsPostBack, ViewState, out userid, out address, out user, out binding, out hostNameIdentifier, out configName, out version, out platform, out hoster, false);
     else
     {
         hostNameIdentifier = Request["name"];
         configName = Request["cfgSvc"];
     }
     MSMQ.Visible = false;
     ConnectionRepeater.ItemDataBound += new RepeaterItemEventHandler(ConnectionRepeater_ItemDataBound);
     viewTheType = (string)Request["viewType"];
     if (viewTheType == null || viewTheType == "")
         viewTheType = ConfigUtility.HOST_TYPE_CONNECTED_SERVICE.ToString();
     viewType = Convert.ToInt32(viewTheType);
     switch (viewType)
     {
         case ConfigUtility.HOST_TYPE_CONNECTED_SERVICE:
             {
                 ViewTypeHosts.CssClass = "LoginButton";
                 ViewTypeClients.CssClass = "LoginButtonNonSelected";
                 AddConnection.Enabled = true;
                 break;
             }
         case ConfigUtility.HOST_TYPE_CONNECTED_CLIENT_CONFIG:
             {
                 ViewTypeClients.CssClass = "LoginButton";
                 ViewTypeHosts.CssClass = "LoginButtonNonSelected";
                 AddConnection.Enabled = false;
                 break;
             }
     }
     getData();
     postback = "?name=" + hostNameIdentifier + "&cfgSvc=" + configName + "&version=" + version + "&platform=" + platform + "&hoster=" + hoster;
     ConnectionRepeater.DataBind();
     TopNode.PostBackUrl = ConfigSettings.PAGE_NODES;
     ServiceVersion.Text = version;
     ServicePlatform.Text = platform;
     ServiceHoster.Text = hoster;
     TopNodeName.Text = hostNameIdentifier;
     ReturnLabel.Text = "<a class=\"Return\" href=\"" + ConfigSettings.PAGE_NODES + postback + "\">Return to Home Page</a>";
     ViewTypeHosts.PostBackUrl = ConfigSettings.PAGE_CONNECTIONS + postback + "&viewType=" + ConfigUtility.HOST_TYPE_CONNECTED_SERVICE.ToString();
     ViewTypeClients.PostBackUrl = ConfigSettings.PAGE_CONNECTIONS + postback + "&viewType=" + ConfigUtility.HOST_TYPE_CONNECTED_CLIENT_CONFIG.ToString();
     AddConnection.PostBackUrl = ConfigSettings.PAGE_ADD_CONNECTION + postback;
     GetImageButton.runtimePoweredBy(platform, RuntimePlatform);
 }
开发者ID:vactorwu,项目名称:catch23-project,代码行数:49,代码来源:ConnectionPoint.aspx.cs

示例7: HandleReport

        public void HandleReport(SessionInfo report)
        {
            string output = JsonConvert.SerializeObject(report, Formatting.Indented);
            string dir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sessionresults");

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            StreamWriter writer =
                new StreamWriter(
                    Path.Combine(
                        dir,
                        new DateTime(report.Timestamp, DateTimeKind.Utc).ToString("yyyyMMdd_HHmmss") + "_" + report.TrackName + "_"
                        + report.SessionName + ".json"));
            writer.Write(output);
            writer.Close();
            writer.Dispose();
        }
开发者ID:flitzi,项目名称:AC_SERVER_APPS,代码行数:19,代码来源:JsonReportWriter.cs

示例8: TestSessionIssuerMethod

        public void TestSessionIssuerMethod()
        {
            SessionTokenIssuer.Instance.SetPurgeTimeout(new TimeSpan(0, 0, 5));

            var session1 = new SessionInfo { Expire = DateTime.UtcNow.AddMinutes(1), Session = Guid.NewGuid().ToString() };
            SessionTokenIssuer.Instance.AddOrUpdate(session1, Guid.NewGuid().ToString());
            var data = SessionTokenIssuer.Instance.Get(session1);
            Assert.IsFalse(string.IsNullOrEmpty(data));
            Assert.IsTrue(SessionTokenIssuer.Instance.Remove(session1));

            Task.Factory.StartNew(Producer);
            Task.Factory.StartNew(Consumer);

            Thread.Sleep(67000);

            Assert.IsTrue(SessionTokenIssuer.Instance.Count <= 10);
            Assert.IsTrue(SessionTokenIssuer.Instance.CountUser <= 10);

            SessionTokenIssuer.Instance.Dispose();
        }
开发者ID:OleksandrKulchytskyi,项目名称:Sharedeployed,代码行数:20,代码来源:SessionIssuerTest.cs

示例9: CreateSession

        /// <summary>
        /// Creates a session ID, registers the session info in the Sessions collection, and returns the appropriate session cookie.
        /// </summary>
        /// <returns>The sessions.</returns>
        private System.Net.Cookie CreateSession()
        {
            lock (SessionsSyncLock)
            {
                var sessionId = Convert.ToBase64String(
                    System.Text.Encoding.UTF8.GetBytes(
                        Guid.NewGuid().ToString() + DateTime.Now.Millisecond.ToString() + DateTime.Now.Ticks.ToString()));
                var sessionCookie = string.IsNullOrWhiteSpace(CookiePath) ?
                new System.Net.Cookie(SessionCookieName, sessionId) :
                new System.Net.Cookie(SessionCookieName, sessionId, CookiePath);

                m_Sessions[sessionId] = new SessionInfo()
                {
                    SessionId = sessionId,
                    DateCreated = DateTime.Now,
                    LastActivity = DateTime.Now
                };

                return sessionCookie;
            }
        }
开发者ID:unosquare,项目名称:embedio,代码行数:25,代码来源:LocalSessionModule.cs

示例10: HandleReport

        public void HandleReport(SessionInfo report)
        {
            string dir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sessionreports");

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            string filePath = Path.Combine(dir, new DateTime(report.Timestamp, DateTimeKind.Utc).ToString("yyyyMMdd_HHmmss") + "_" + report.TrackName + "_" + report.SessionName + ".xml");

            DataContractSerializer serializer = new DataContractSerializer(typeof(SessionInfo));

            XmlWriterSettings settings = new XmlWriterSettings()
            {
                Indent = true,
                IndentChars = "\t"
            };

            using (XmlWriter writer = XmlWriter.Create(filePath, settings))
            {
                serializer.WriteObject(writer, report);
            }
        }
开发者ID:flitzi,项目名称:acplugins,代码行数:24,代码来源:XmlSessionReportWriter.cs

示例11: SearchTopLevelArticles

        // 检索顶层文章
        // return:
        //		-1	error
        //		其他 命中数
        private int SearchTopLevelArticles(
            SessionInfo sessioninfo,
            System.Web.UI.Page page,
            out string strError)
        {
            strError = "";

            if (page != null
                && page.Response.IsClientConnected == false)	// 灵敏中断
            {
                strError = "中断";
                return -1;
            }

            // 检索全部评注文章 一定时间范围内的?
            List<string> dbnames = new List<string>();
            for (int i = 0; i < this.ItemDbs.Count; i++)
            {
                ItemDbCfg cfg = this.ItemDbs[i];
                string strDbName = cfg.CommentDbName;
                if (String.IsNullOrEmpty(strDbName) == true)
                    continue;
                dbnames.Add(strDbName);
            }

            DateTime now = DateTime.Now;
            DateTime oneyearbefore = now - new TimeSpan(365, 0, 0, 0);
            string strTime = DateTimeUtil.Rfc1123DateTimeString(oneyearbefore.ToUniversalTime());

            string strQueryXml = "";
            for (int i = 0; i < dbnames.Count; i++)
            {
                string strDbName = dbnames[i];
                string strOneQueryXml = "<target list='" + strDbName + ":" + "最后修改时间'><item><word>"    // <order>DESC</order>
                    + strTime + "</word><match>exact</match><relation>" + StringUtil.GetXmlStringSimple(">=") + "</relation><dataType>number</dataType><maxCount>"
                    + "-1"// Convert.ToString(m_nMaxLineCount)
                    + "</maxCount></item><lang>zh</lang></target>";

                if (i > 0)
                    strQueryXml += "<operator value='OR' />";
                strQueryXml += strOneQueryXml;
            }

            if (dbnames.Count > 0)
                strQueryXml = "<group>" + strQueryXml + "</group>";

            RmsChannel channel = sessioninfo.Channels.GetChannel(this.WsUrl);
            Debug.Assert(channel != null, "Channels.GetChannel 异常");

            if (page != null)
            {
                page.Response.Write("--- begin search ...<br/>");
                page.Response.Flush();
            }

            DateTime time = DateTime.Now;

            long nRet = channel.DoSearch(strQueryXml,
                "default",
                out strError);
            if (nRet == -1)
            {
                strError = "检索时出错: " + strError;
                return -1;
            }

                TimeSpan delta = DateTime.Now - time;
            if (page != null)
            {
                page.Response.Write("search end. hitcount=" + nRet.ToString() + ", time=" + delta.ToString() + "<br/>");
                page.Response.Flush();
            }


            if (nRet == 0)
                return 0;	// not found



            if (page != null
                && page.Response.IsClientConnected == false)	// 灵敏中断
            {
                strError = "中断";
                return -1;
            }
            if (page != null)
            {
                page.Response.Write("--- begin get search result ...<br/>");
                page.Response.Flush();
            }

            time = DateTime.Now;

            List<string> aPath = null;
            nRet = channel.DoGetSearchResult(
                "default",
//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:AppColumn.cs

示例12: CreateCommentColumn

        // [外部调用]
        // 创建内存和物理存储对象
        public int CreateCommentColumn(
            SessionInfo sessioninfo,
            System.Web.UI.Page page,
            out string strError)
        {
            this.m_lockCommentColumn.AcquireWriterLock(m_nCommentColumnLockTimeout);
            try
            {
                strError = "";
                int nRet = 0;

                if (sessioninfo.Account == null
    || StringUtil.IsInList("managecache", sessioninfo.RightsOrigin) == false)
                {
                    strError = "当前帐户不具备 managecache 权限,不能创建栏目缓存";
                    return -1;
                }

                this.CloseCommentColumn();

                if (page != null
                    && page.Response.IsClientConnected == false)	// 灵敏中断
                {
                    strError = "中断";
                    return -1;
                }

                if (this.CommentColumn == null)
                    this.CommentColumn = new ColumnStorage();

                this.CommentColumn.ReadOnly = false;
                this.CommentColumn.m_strBigFileName = this.StorageFileName;
                this.CommentColumn.m_strSmallFileName = this.StorageFileName + ".index";

                this.CommentColumn.Open(true);
                this.CommentColumn.Clear();
                // 检索
                nRet = SearchTopLevelArticles(
                    sessioninfo,
                    page,
                    out strError);
                if (nRet == -1)
                    return -1;

                // 排序
                if (page != null)
                {
                    page.Response.Write("--- begin sort ...<br/>");
                    page.Response.Flush();
                }

                DateTime time = DateTime.Now;

                this.CommentColumn.Sort();

                if (page != null)
                {
                    TimeSpan delta = DateTime.Now - time;
                    page.Response.Write("sort end. time=" + delta.ToString() + "<br/>");
                    page.Response.Flush();
                }

                // 保存物理文件
                string strTemp1;
                string strTemp2;
                this.CommentColumn.Detach(out strTemp1,
                    out strTemp2);

                this.CommentColumn.ReadOnly = true;

                this.CloseCommentColumn();

                // 重新装载
                nRet = LoadCommentColumn(
                    this.StorageFileName,
                    out strError);
                if (nRet == -1)
                    return -1;

                return 0;
            }
            finally
            {
                this.m_lockCommentColumn.ReleaseWriterLock();
            }
        }
开发者ID:renyh1013,项目名称:dp2,代码行数:88,代码来源:AppColumn.cs

示例13: WriteLogixData

		public static WriteDataServiceReply WriteLogixData(SessionInfo si, string tagAddress, ushort dataType, ushort elementCount, byte[] data, ushort structHandle)
开发者ID:jacobbarsoe,项目名称:ControlLogixNET,代码行数:1,代码来源:LogixServices.cs

示例14: ReadLogixData

        public static ReadDataServiceReply ReadLogixData(SessionInfo si, string tagAddress, ushort elementCount)
        {
            int requestSize = 0;
            ReadDataServiceRequest request = BuildLogixReadDataRequest(tagAddress, elementCount, out requestSize);

            EncapsRRData rrData = new EncapsRRData();
            rrData.CPF = new CommonPacket();
            rrData.CPF.AddressItem = CommonPacketItem.GetConnectedAddressItem(si.ConnectionParameters.O2T_CID);
            rrData.CPF.DataItem = CommonPacketItem.GetConnectedDataItem(request.Pack(), SequenceNumberGenerator.SequenceNumber);
            rrData.Timeout = 2000;

            EncapsReply reply = si.SendUnitData(rrData.CPF.AddressItem, rrData.CPF.DataItem);

            if (reply == null)
                return null;

            if (reply.Status != 0 && reply.Status != 0x06)
            {
                //si.LastSessionError = (int)reply.Status;
                return null;
            }

            return new ReadDataServiceReply(reply);
        }
开发者ID:jacobbarsoe,项目名称:ControlLogixNET,代码行数:24,代码来源:LogixServices.cs

示例15: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     string hostedID = null;
     Page.Form.DefaultFocus = SoaMapButton.ClientID;
     Input.getHostData(IsPostBack, ViewState, out userid, out address, out user, out binding,out hostNameIdentifier, out configName, out theVersion, out thePlatform, out theHoster, true);
     if (IsPostBack)
     {
         SessionInfo info = new SessionInfo();
         info.getSessionData(false, out address, out user, out binding, out hostNameIdentifier, out configName, out theHoster, out theVersion, out thePlatform, out hostedID);
     }
     InProcessRepeater.ItemDataBound += new RepeaterItemEventHandler(InProcessRepeater_ItemDataBound);
     CompositeServicesRepeater.ItemDataBound += new RepeaterItemEventHandler(CompositeServicesRepeater_ItemDataBound);
     List<ServiceConfigurationData> blankData = new List<ServiceConfigurationData>();
     ServiceConfigurationData blankItem = new ServiceConfigurationData();
     blankItem.ServiceHost = "-";
     blankItem.ServiceContract = "-";
     blankItem.Status = "-";
     blankData.Add(blankItem);
     int level;
     string levelString = (string)Request["level"];
     if (levelString == null)
         level = ConfigUtility.CONFIG_LEVEL_BASIC;
     else
     {
         level = Convert.ToInt32(levelString);
     }
     TopNode.PostBackUrl = ConfigSettings.PAGE_NODES;
     string action = Request["action"];
     if (action != "navigate")
     {
         traversePath = DynamicTraversePath.getTraversePath(hostNameIdentifier, configName, ref configProxy, address, binding, user);
         compositeServiceData = configProxy.getServiceConfiguration(hostNameIdentifier, configName, level, true, traversePath, user);
         if (compositeServiceData != null)
         {
             if (compositeServiceData.Count > 0 && compositeServiceData[0] != null)
             {
                 string postback = "?name=" + compositeServiceData[0].ServiceHost + "&cfgSvc=" + compositeServiceData[0].ConfigServiceImplementationClassName + "&version=" + compositeServiceData[0].ServiceVersion + "&platform=" + compositeServiceData[0].RunTimePlatform + "&hoster=" + compositeServiceData[0].ServiceHoster;
                 Hosted.PostBackUrl = ConfigSettings.PAGE_VHOSTS + postback;
                 Connected.PostBackUrl = ConfigSettings.PAGE_CONNECTED_SERVICES + postback;
                 Connections.PostBackUrl = ConfigSettings.PAGE_CONNECTIONS + postback;
                 Logs.PostBackUrl = ConfigSettings.PAGE_AUDIT + postback;
                 Users.PostBackUrl = ConfigSettings.PAGE_USERS + postback;
                 InProcessRepeater.DataSource = compositeServiceData;
                 InProcessRepeater.DataBind();
                 TopNodeName.Text = hostNameIdentifier;
                 ServiceVersion.Text = theVersion;
                 ServiceHoster.Text = "" + theHoster;
                 ServicePlatform.Text = "" + thePlatform;
                 GetImageButton.runtimePoweredBy(thePlatform, RuntimePlatform);
                 if (compositeServiceData[0].ConnectedServiceConfigurationData != null && compositeServiceData[0].ConnectedServiceConfigurationData.Count > 0)
                 {
                     CompositeServicesRepeater.DataSource = compositeServiceData[0].ConnectedServiceConfigurationData;
                 }
                 else
                 {
                     CompositeServicesRepeater.DataSource = blankData;
                 }
                 CompositeServicesRepeater.DataBind();
             }
             else
                 Response.Redirect(ConfigSettings.PAGE_NODES,true);
         }
         else
         {
             Response.Redirect(ConfigSettings.PAGE_LOGOUT,true);
         }
     }
 }
开发者ID:vactorwu,项目名称:catch23-project,代码行数:68,代码来源:Nodes.aspx.cs


注:本文中的SessionInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。