C# 解决IE文件名乱码方法

2021-03-09 13:27

阅读:537

标签:sharp   out   article   方法   ==   summary   sha   div   returns   

笔录

     /// 
     /// 解决IE文件名乱码方法
     /// 
     /// 文件名
     /// 
	public static string clFielName(string fileName)
     {
         System.Web.HttpContext curContext = System.Web.HttpContext.Current;
         string outputFileName = null;
         string browser = curContext.Request.UserAgent.ToUpper();
         if (browser.Contains("MS") == true && browser.Contains("IE") == true)
         {
             outputFileName = System.Web.HttpUtility.UrlEncode(fileName);
         }
         else if (browser.Contains("FIREFOX") == true)
         {
             outputFileName = "\"" + fileName + "\"";
         }
         else
         {
             outputFileName = System.Web.HttpUtility.UrlEncode(fileName);
         }
         return outputFileName;
     }

  

转载: https://blog.csdn.net/u014353113/article/details/84784680

C# 解决IE文件名乱码方法

标签:sharp   out   article   方法   ==   summary   sha   div   returns   

原文地址:https://www.cnblogs.com/IT-Ramon/p/12746234.html


评论


亲,登录后才可以留言!