Javascript:从项目文件夹中读取文本文件到字符串

时间:2017-07-08 15:48:10

标签: string variables

我们如何将项目文件路径中的文本文件内容复制到javascript中的字符串变量。

我使用下面的代码,但它给出了“拒绝访问”错误。

WHERE IN

1 个答案:

答案 0 :(得分:0)

在C#代码中阅读html模板,然后将其发送到您的html代码并分配给innerHTML

   using (StreamReader sr = new StreamReader(@"D:\Template.html")){
   // Read the stream to a string, and write the string to the console.
   obj.svar = sr.ReadToEnd().Replace(Environment.NewLine, " ");
   //Console.WriteLine(line);
   }