ASP.NET实现在线播放FLV视频件的代码
ASP.NET实现在线播放FLV视频件的代码
前台调用代码
<!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">
<div>
<table>
<tr>
<td><div id="video_content"
runat="server" style=""></div> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
后台调用代码
protected void Page_Load(object sender, EventArgs e)
{
this.video_content.InnerHtml =
PlayMedia.Play("http://hot.tudou.com/flv/005/680/205/5680205.flv",
472,385);
}
视频播放类:
using System;
using System.Collections.Generic;
using
System.Text;
namespace Common
{
public class PlayMedia
{
public PlayMedia()
{
//
// TOD 在此处添加构造函数逻辑
//
}
public static string Play(string url, int width, int
height)
&
相关文档:
在Web.config文件的 <system.web></system.web>这两个节点中间插入需要映射的URL
<urlMappings enabled="true">
<add url="~/用户要访问的页面.aspx" mappedUrl="~/要重定向到的页面.aspx"/>
</urlMappings> ......
string LogPath;
Thread thread;
void WriteLog()
{
while (true)
{
StreamWriter sw = new StreamWriter(LogPath, true, Encoding.UTF8);
sw.WriteLine(thread.Name + ":" + DateTime.Now.ToString());
sw.Close();
Thr ......
1. 数据库访问性能优化
数据库的连接和关闭
访问数据库资源需要创建连接、打开连接和关闭连接几个操作。这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源。 ASP.NET中提供了连接池(Connection Pool)改善打开和关闭数据库对性能的影响。系统将用户的数据库连接放在连接池中,需要时取出,关闭时 ......
1. 当不需要使用Session的时候请关闭
关闭Session当不需要使用的时候
• 若要禁用页的会话状态,请将@ Page 指令中的EnableSessionState 属性设置为false。例如, <%@ Page EnableSessionState="false" %>。
• 注意如果页需要访问会话变量,但不打算创建或修改它们,则将 ......
Mysql的connector/net5.0下载地址:
http://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-5.0.6.zip/from/pick
安装好以后,
点属性,然后点查找目标,点向上一层目录,找到Binaries\.NET 2.0,然后将这个文件复制到你的工程目录下,一般这样的DLL文件会保存到bin目录下.
在代码页里输入using Mysql.Da ......