• C#中在.xhtml文件中include的html文件,生成出现的空格问题


    当需要在.xhtml页面中引用html文件时,在生成html文件需要生成为【不带签名】的html,否则在生成的html文件中有空格,这样会影响页面的布局

    代码如下:希望大家可以多多指教

      private void CreateTopCityHtml()    

         {          

       string cityHtml = GetTopCityHtml();   //获取html片段     

         string strLAWebRoot = System.Configuration.ConfigurationManager.AppSettings["root"].ToString();//从web.config中读取的

                string savePath = strLAWebRoot + "\\html\\index\\city\\";   

              if (!System.IO.Directory.Exists(savePath))         

        {                

    System.IO.Directory.CreateDirectory(savePath);       

          }            

    string fileName = "topcity.htm";       

          string filepath = Path.Combine(savePath, fileName);       

          UTF8Encoding utf8 = new UTF8Encoding(false);  //不带签名的    

           using (StreamWriter streamWriter = new StreamWriter(filepath, false, utf8)) //保存地址        

         {                

    streamWriter.WriteLine(cityHtml);      

               streamWriter.Flush();        

             streamWriter.Close();    

             }    

         }

    如果你总是等来等去,最终什么都没有等到
  • 相关阅读:
    C#中页面之间跳转方法比较
    C#中web页面之间传递数组参数
    js跳转传递参数
    枚举
    js操作做GridView
    数据库登录问题汇总
    数据库登录遇到的问题
    关于配置服务器(IIS7)(二)
    关于配置服务器(IIS7)
    使用JavaScript设置、获取父子页面中的值
  • 原文地址:https://www.cnblogs.com/jiaguo648517982/p/3012150.html
Copyright © 2020-2023  润新知