- 22
- 0
- 约3.13千字
- 约 7页
- 2021-09-10 发布于山东
- 举报
(完整word版)web实验二简易聊天室
(完整word版)web实验二简易聊天室
(完整word版)web实验二简易聊天室
web 系统开发
实验报告
实验二
实验题目 :内建对象的使用——简易聊天室
实验类型 : 设计型
指导老师: 潘凤
专业班级 :
姓 名:
学 号:
2014年04 月 02 日
一、实验题目
内建对象的使用——简易聊天室
二、 实验目的和要求
利用第四、五章所学知识进行页面开发,运用 web 服务器控件完成页面的界面设计,用内建对象实现所需功能。
.要求页面友好,交互性强。
上机前预习实验, 同学们相互间可以讨论; 上机过程中要求独立完成; 设计出具有各
自风格的页面。
三、实验内容
创建登录页面
用户输入昵称即可进入聊天室。
实现简单的聊天室
用户登录进去后即可聊天, 要能显示发言人的登录姓名、 发言内容和发言时间。 在左侧或者右侧显示出所有进入聊天室的用户的姓名列表。
利用 Mail 对象实现在线邮件的发送。四、实验代码
登录界面代码:
Partial Class login
If Me.txtName.Text = Then
MsgBox( 请输入用户名 )
Else
Dim str As String = name + Application(count).ToString
Application(count) = Application(count) + 1
Session.Add(name, Me.txtName.Text)
Response.Redirect(index.aspx)
End If
End Sub
End Class
邮件界面代码:
Partial Class email
Protected Sub btnSubmit_Click(ByVal
sender
As
Object,
ByVal
e As
Dim objMail As New MailMessage
Dim filename, filepath As String
filename = Path.GetFileName(uploadfile.PostedFile.FileName)
filepath = d:\ filename
uploadfile.PostedFile.SaveAs(filepath)
Dim objAttach As New MailAttachment(filepath)
objMail.Attachments.Add(objAttach)
SmtpMail.SmtpServer =
Try
SmtpMail.Send(objMail)
Catch ex As Exception
Dim str As String
End Try
message.Text = font color = red + 发ぁ ?送í成é功|! ? + /font
End Sub
Protected Sub btnReturn_Click(ByVal sender As Object, ByVal
e As
Response.Redirect(xiaoxi.aspx)
End Sub
End Class
消息代码:
Partial Class submit
Protected Sub enter_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim str As String
Application.Lock()
str = show + Application(number).ToString
Application(str) = font color=blue + Session(name) + :/font +
Me.txtSpeak.Text + + + + + + time: + Now() + /br
Application(number) = Application(number) + 1
Application.UnLock()
Me.txtSpeak.Text =
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Me.name.Text = Session(name)
End Sub
Protected Sub enterEmail_Click(ByVal sender As Object, ByVal e As
Response.Redirect(email.aspx)
End Sub
End Class
在线人数代码:
Partial
原创力文档

文档评论(0)