server.aspx.cs

来自「某贸易公司项目管理系统源码 该项目是一个完整的商用项目」· CS 代码 · 共 111 行

CS
111
字号
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
//5_1_a_s_p_x.c_o_m

namespace UChat.Server
{
	/// <summary>
	/// Summary description for Server.
	/// </summary>
	public partial class Server : System.Web.UI.Page
	{
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			if(Request["action"]!=null && Request["action"].Trim()!="")
			{
				switch(Request["action"])
				{
					case "Login":
						processLogin();
						break;
					case "PostMsg":
						processPostMsg();
						break;
					case "GetMsg":
						processGetMsg();
						break;
					case "UserList":
						processUserList();
						break;
					default:
						break;
				}
			}
		}

		protected void processLogin()
		{
			if( Request.QueryString.Count == 0 )
				return;

			string user = Request.QueryString[ "u" ].ToString();
			Guid g = Guid.NewGuid();
			Global.Engine.AddUser( g.ToString(), user);

			Response.Redirect( "Chat.aspx?" + g.ToString() );
		}

		protected void processPostMsg()
		{
			if( Request.QueryString.Count != 4 )
				return;

			if( Request.QueryString[ "u" ] == null )
				return;

			if( Request.QueryString[ "t" ] == null )
				return;


			string user = Request.QueryString[ "u" ];
			string chat = Request.QueryString[ "t" ];

			if( !Global.Engine.GuidExists( user ) )
				return;


			Global.Engine.AddText( user, chat );
		}

		protected void processGetMsg()
		{
			Response.Write( Global.Engine.BufferText );
		}

		protected void processUserList()
		{
			Response.Write( Global.Engine.UserList );
		}


		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    

		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?