日期:2009-12-23  浏览次数:20979 次

在播放视频时,直接查看页面源文件可看到视频文件地址,MediaPlayer控件播放器将在页面上加上如下初始化语句:

  MediaPlayer控件初始化可查看到源文件地址

  Sys.Application.add_init(function()

  {

  $create(Sys.UI.Silverlight.MediaPlayer,

  {

  "autoPlay":true,"mediaSource":"http://211.142.31.235/Nas1/VOD/CP0001/490Kbps/D/DI/DIA/DiaoZhongYuan1/DiaoZhongYuan1.wmv",

  "scaleMode":2,"source":"UserControl/playerTheme/player.xaml","volume":1},

  null, null,

  $get("myUserMediaPlayer_player_parent"));

  });

  解决方案是先建立一个字符串加密解密服务

  加密、解密工具类

  1/**//// <summary>

  2    /// 对字符串进行、加解密的工具类

  3    /// </summary>

  4    public class DESEncryptor

  5  {

  6        静态公共方法#region 静态公共方法

  7        /**//// <summary>

  8        /// 对字符串进行加密

  9        /// </summary>

  10        /// <param name="strSource">源字符串</param>

  11        /// <returns>加密后的字符串</returns>

  12        public static string  ExecEncrypt(string strSource)

  13        {

  14            DESEncryptor desEncryptor = new DESEncryptor() ;

  15            desEncryptor.InputString = strSource ;

  16            desEncryptor.DesEncrypt() ;

  17            return desEncryptor.OutString ;

  18        }

  19        /**//// <summary>

  20        /// 对已经加密的字符串进行解密

  21        /// </summary>

  22        /// <param name="strSource">已经加密的字符串</param>

  23        /// <returns>还原后的字符串</returns>

  24        public static string  ExecDeEncrypt(string strSource)

  25        {

  26            DESEncryptor desEncryptor = new DESEncryptor() ;

  27            desEncryptor.InputString = strSource ;

  28            desEncryptor.DesDecrypt() ;

  29            return desEncryptor.OutString ;

  30        }

  31        #endregion

  32

  33        私有成员#region 私有成员

  34        /**//// <summary>

  35        /// 输入字符串

  36        /// </summary>

  37        private string inputString=null;

  38        /**//// <summary>

  39        /// 输出字符串

  40        /// </summary>

  41        private string outString=null;

  42        /**//// <summary>

  43        /// 输入文件路径

  44  &nbs