master
editor 11 months ago
commit ea32d0898c

@ -0,0 +1,57 @@
ASPX在线聊天系统
一、源码描述
Aspx在线聊天系统
环境VS2022 Aspx Sq2019
二、功能介绍
1 运行程序后,选择聊天室会跳转登陆页面.
2 登录成功后即可聊天.
3 重新开一个浏览器,登录聊天即可验证聊天功能.
三、注意事项
1、在项目web.config修改数据库连接字符串附加数据库。
2、账号与密码附加数据库后查看即可 。
3、ctrl+F5运行即可。
作者: coderbest
如需获得该源码的视频、更新等更多资料请访问: https://www.51aspx.com/Code/OnlineChatSystem
------------------------------------------------------------------------------------------------
源码服务专家
官网: https://www.51aspx.com
讨论圈: https://club.51aspx.com/
平台声明:
1.51Aspx平台上提供下载的资源为免费、共享、商业三类源码,其中免费和共享源码仅供个人学习和研究使用,商业源码请在相应的授权许可条件下使用;
2.51Aspx平台对提供下载的软件及其它资源不拥有任何权利,其版权归属源码合法拥有者所有;
3.著作权人发现本网站载有侵害其合法权益的内容或作品,请与我们联系( 登录官网与客服反馈或发送邮件到support@51Aspx.com
4.51Aspx平台不保证提供的下载资源的准确性、安全性和完整性;
友情提示:
一般数据库文件默认在 DB_51Aspx 文件夹下
默认账号密码一般均为51Aspx
关于源码使用常见问题及解决方案,请参阅: https://www.51aspx.com/Help

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddLiao.aspx.cs" Inherits="AddChat" StylesheetTheme="ASPNETAjaxWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>添加新的聊天室</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table class="Table" border="0" cellpadding="2" bgcolor="Black" cellspacing="1">
<tr bgcolor="white">
<td colspan="2"><hr /></td>
</tr>

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using ASPNETAJAXWeb.AjaxChat;
using ASPNETAJAXWeb.ValidateCode.Page;

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using System.Collections.Generic;
namespace ASPNETAJAXWeb.AjaxChat
{

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
namespace ASPNETAJAXWeb.AjaxChat
{
/// <summary>
/// 保存用户登录信息的类
/// </summary>
public class UserInfo
{
private int userID;
private int chatID = -1;
private string username;

@ -0,0 +1,15 @@
body
{
font-family: "Tahoma";
font-size:9pt;
margin-top:0;
background-color:#CCCCFF;
}
.Text
{
font:Tahoma;
font-size:9pt;
}
.Title

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddLiao.aspx.cs" Inherits="AddChat" StylesheetTheme="ASPNETAjaxWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>添加新的聊天室</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table class="Table" border="0" cellpadding="2" bgcolor="Black" cellspacing="1">
<tr bgcolor="white">
<td colspan="2"><hr /></td>
</tr>

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using ASPNETAJAXWeb.AjaxChat;
using ASPNETAJAXWeb.ValidateCode.Page;

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using System.Collections.Generic;
namespace ASPNETAJAXWeb.AjaxChat
{

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
namespace ASPNETAJAXWeb.AjaxChat
{
/// <summary>
/// 保存用户登录信息的类
/// </summary>
public class UserInfo
{
private int userID;
private int chatID = -1;
private string username;

@ -0,0 +1,15 @@
body
{
font-family: "Tahoma";
font-size:9pt;
margin-top:0;
background-color:#CCCCFF;
}
.Text
{
font:Tahoma;
font-size:9pt;
}
.Title

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" StylesheetTheme="ASPNETAjaxWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>选择聊天室页面</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table border="0" cellpadding="0" cellspacing="0" width="200">
<tr>
<td>请选择聊天室:</td>
</tr>
<tr align="left">

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///<2F><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>
using ASPNETAJAXWeb.AjaxChat;
using System.Collections.Generic;
public partial class Default : System.Web.UI.Page
{

@ -0,0 +1,15 @@
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="ASPNETAJAXWeb.AjaxChat" %>
<script runat="server">
/// <summary>
/// 保存登录用户的列表
/// </summary>
public static List<UserInfo> Users = new List<UserInfo>();
void Application_Start(object sender, EventArgs e)
{ ///登录用户列表初始化
Users.Clear();
}

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" StylesheetTheme="ASPNETAjaxWeb" CodeFile="LiaoManage.aspx.cs" Inherits="ChatManage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>聊天室管理</title>
</head>
<body style="text-align: center">
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table class="Table" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="white">
<td style="width: 736px">
<asp:UpdatePanel runat="server" ID="upForm">

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using ASPNETAJAXWeb.AjaxChat;
public partial class ChatManage : System.Web.UI.Page

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LiaoTian.aspx.cs" Inherits="ChatRoom" StylesheetTheme="ASPNETAjaxWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>聊天页面</title>
</head>
<body>
<form id="form1" runat="server" defaultbutton="btnCommit" defaultfocus="tbMessage">
<asp:ScriptManager ID="sm" runat="server" />
<asp:UpdatePanel ID="upUser" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<table border="0" cellpadding="2" cellspacing="0" class="Table">
<tr>

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using ASPNETAJAXWeb.AjaxChat;
using System.Data.SqlClient;
using System.Text;

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" StylesheetTheme="ASPNETAjaxWeb" Inherits="UserLogin" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>用户登录</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table class="Table" cellpadding="2" cellspacing="0" border="1" width="60%" bordercolor="green" style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none">
<tr>
<td width="150" height="30" valign="top" align="right">用户名称:</td>
<td valign="middle">

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ASPNETAJAXWeb.AjaxChat;
using ASPNETAJAXWeb.ValidateCode.Page;
using System.Data.SqlClient;
public partial class UserLogin : System.Web.UI.Page

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UpdateLiao.aspx.cs" Inherits="UpdateLiaotian" StylesheetTheme="ASPNETAjaxWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>修改聊天室</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table class="Table" border="0" cellpadding="2" bgcolor="Black" cellspacing="1">
<tr bgcolor="white">
<td colspan="2"><hr /></td>
</tr>
<tr bgcolor="white">

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using ASPNETAJAXWeb.AjaxChat;
using ASPNETAJAXWeb.ValidateCode.Page;
using System.Data.SqlClient;

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<connectionStrings>

@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="false" Inherits="ASPNETAJAXWeb.ValidateCode.Page.ValidateCode" %>

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" StylesheetTheme="ASPNETAjaxWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>选择聊天室页面</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table border="0" cellpadding="0" cellspacing="0" width="200">
<tr>
<td>请选择聊天室:</td>
</tr>
<tr align="left">

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///<2F><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>
using ASPNETAJAXWeb.AjaxChat;
using System.Collections.Generic;
public partial class Default : System.Web.UI.Page
{

@ -0,0 +1,15 @@
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="ASPNETAJAXWeb.AjaxChat" %>
<script runat="server">
/// <summary>
/// 保存登录用户的列表
/// </summary>
public static List<UserInfo> Users = new List<UserInfo>();
void Application_Start(object sender, EventArgs e)
{ ///登录用户列表初始化
Users.Clear();
}

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" StylesheetTheme="ASPNETAjaxWeb" CodeFile="LiaoManage.aspx.cs" Inherits="ChatManage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>聊天室管理</title>
</head>
<body style="text-align: center">
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table class="Table" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="white">
<td style="width: 736px">
<asp:UpdatePanel runat="server" ID="upForm">

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using ASPNETAJAXWeb.AjaxChat;
public partial class ChatManage : System.Web.UI.Page

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LiaoTian.aspx.cs" Inherits="ChatRoom" StylesheetTheme="ASPNETAjaxWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>聊天页面</title>
</head>
<body>
<form id="form1" runat="server" defaultbutton="btnCommit" defaultfocus="tbMessage">
<asp:ScriptManager ID="sm" runat="server" />
<asp:UpdatePanel ID="upUser" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<table border="0" cellpadding="2" cellspacing="0" class="Table">
<tr>

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using ASPNETAJAXWeb.AjaxChat;
using System.Data.SqlClient;
using System.Text;

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" StylesheetTheme="ASPNETAjaxWeb" Inherits="UserLogin" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>用户登录</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table class="Table" cellpadding="2" cellspacing="0" border="1" width="60%" bordercolor="green" style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none">
<tr>
<td width="150" height="30" valign="top" align="right">用户名称:</td>
<td valign="middle">

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ASPNETAJAXWeb.AjaxChat;
using ASPNETAJAXWeb.ValidateCode.Page;
using System.Data.SqlClient;
public partial class UserLogin : System.Web.UI.Page

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UpdateLiao.aspx.cs" Inherits="UpdateLiaotian" StylesheetTheme="ASPNETAjaxWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>修改聊天室</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<table class="Table" border="0" cellpadding="2" bgcolor="Black" cellspacing="1">
<tr bgcolor="white">
<td colspan="2"><hr /></td>
</tr>
<tr bgcolor="white">

@ -0,0 +1,15 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///引入新的命名空间
using ASPNETAJAXWeb.AjaxChat;
using ASPNETAJAXWeb.ValidateCode.Page;
using System.Data.SqlClient;

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="SQLCONNECTIONSTRING" connectionString="data source=.;user id=sa;pwd=51Aspx;database=Liao" providerName="System.Data.SqlClient"/>
</connectionStrings>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.8.1" />
</system.Web>
-->
<system.web>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">

@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="false" Inherits="ASPNETAJAXWeb.ValidateCode.Page.ValidateCode" %>
Loading…
Cancel
Save