后台输出js (mvc 后台输出一个可以定时跳转的页面)

  1   public void DownLoadFile()
  2 {
  3    Response.ContentType = "text/html";
  4    Response.Write(GetMsg(1));
  5   }
  6 
  7 
  8  public string GetMsg(int type)
  9         {
 10             StringBuilder RtStr = new StringBuilder();
 11             if (type == 0)//文件丢失
 12             {
 13                 RtStr.Append(@"<!DOCTYPE html>    <html>  <head> <meta charset='utf-8'> <title>文件有误</title>
 14                      
 15                      <script src='../../js/jquery-3.1.0.min.js' charset ='UTF-8' ></script>
 16                     
 17                       <script> 
 18                      $(function() { 
 19                                             setInterval(function() { 
 20                                         window.history.go(-1);
 21                                             }, 3000);
 22                                         }); 
 23                     
 24                         </script>
 25                     </head>
 26                     
 27                     <body>
 28                     <br/><br/><br/>  <h1><div style='text-align:center; '>文件有误,请联系管理员。</div></h1>
 29                       
 30                        
 31                     
 32                       
 33                     </body>
 34                     
 35                     </html>");
 36 
 37             }
 38             else if (type == 1)//操作频繁
 39             {
 40 
 41                 RtStr.Append(@"<!DOCTYPE html> 
 42                             <html>
 43 
 44                             <head>
 45 
 46                                 <meta charset='utf-8'>
 47 
 48                                 <title>操作频繁</title>
 49  
 50                              <script src='../../js/jquery-3.1.0.min.js' charset ='UTF-8' ></script>
 51 
 52                               <script> 
 53                              $(function() { 
 54                                                     setInterval(function() { 
 55                                                 window.history.go(-1);
 56                                                     }, 3000);
 57                                                 }); 
 58 
 59                                 </script>
 60                             </head>
 61 
 62                             <body>
 63                             <br/><br/><br/>  <h1><div style='text-align:center; '>操作频繁请一分钟后再试。</div></h1>
 64   
 65    
 66 
 67   
 68                             </body>
 69 
 70                             </html>
 71                        
 72             ");
 73 
 74             }
 75             else//解密失败
 76             {
 77 
 78                 RtStr.Append(@"<!DOCTYPE html> 
 79                             <html>
 80 
 81                             <head>
 82 
 83                                 <meta charset='utf-8'>
 84 
 85                                 <title>解密失败</title>
 86  
 87                              <script src='../../js/jquery-3.1.0.min.js' charset ='UTF-8' ></script>
 88 
 89                               <script> 
 90                              $(function() { 
 91                                                     setInterval(function() { 
 92                                                window.location.href ='" +
 93                                            SendEmail.WebsiteUrl +
 94                                             @"'
 95                                                     }, 3000);
 96                                                 }); 
 97 
 98                                 </script>
 99                             </head>
100 
101                             <body>
102                             <br/><br/><br/>  <h1><div style='text-align:center; '>您的文件自己加了一遍密,解密失败,请联系管理员。</div></h1>
103   
104    
105 
106   
107                             </body>
108 
109                             </html>
110                        
111             ");
112 
113             }
114             return RtStr.ToString();
115         }

猜你喜欢

转载自www.cnblogs.com/xiangrikui94/p/11593445.html
今日推荐