当前位置:网站首页>. net core throws an error and writes it Txt file
. net core throws an error and writes it Txt file
2022-04-21 07:54:00 【Gentleness901】
#region write file If the file exists, add it one by one , If it doesn't exist, create a new one
/// <summary>
/// write file
/// </summary>
/// <param name="Path"> File path </param>
/// <param name="content"> The contents of the document </param>
// Invoke the sample
//string webRootPath = _hostingEnvironment.WebRootPath; // Get relative path
//string strUploadPath = webRootPath + "/Document/";
//string fileLogName = " Error log " + DateTime.Now.ToLongDateString() + "Log.txt";
//WriteFile(strUploadPath + fileLogName, " Test content ");
public static void WriteFile(string path, string content)
{
if (!System.IO.File.Exists(path))
{
System.IO.FileStream f = System.IO.File.Create(path);
f.Close();
}
System.IO.StreamWriter f2 = new System.IO.StreamWriter(path, true, System.Text.Encoding.GetEncoding("gb2312"));
f2.WriteLine(content);
f2.Close();
f2.Dispose();
}
#endregion
版权声明
本文为[Gentleness901]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210629483142.html
边栏推荐
- 蓝牙开源协议栈BTstack汇总
- Fuzzy query between two tables of SQL server and steps of importing Excel data into SQL Server
- Solution to red flag with @ Autowired annotation in idea
- Postgre (PG) - SQL script record
- 基于JeecgBoot的v-has权限控制
- XML encoding and decoding
- 动态生成三级菜单
- Assembly language -- Method of memory location
- GoLang学习资源清单
- 第五站孔孟之乡-----------走迷宫之最短路径
猜你喜欢

Creating Oracle database in Navicat tool

leetcode题目--386.字典序排数,DFS

fiddler调换字体后界面缺少 恢复

Server deployment SVN environment

Renesas ide: development environment configuration during bootloader upgrade of CS + for CC

C语言指针进阶(1.一阶与二阶指针)

Introduction to QT 5.12 actual combat

物联网操作系统Zephyr(入门篇)之1.0 Zephyr简介

服务器部署svn环境

Flutter 环境搭建等基础
随机推荐
High availability system design
服务器部署svn环境
Project storage log
文件打包下载
Oracle-SQL脚本记录
Testing and Benchmarking
注解功能補充
Implementation and application of STM32 system and custom bootloader
虚拟机安装kali 时的默认密码(官网vmx 文件源)
Signals
Oracle SQL script record
laravel实现打包多个文件,并下载
为什么mysql里面设置符合主键它显示我错了?
C# asp. Net calling Baidu character recognition interface
leetcode 142. Circular linked list II
asp. Net JS to realize dynamic addition and file upload
pip list 中已有的模块为什么没法在新project中使用,已解决
URL Parsing
Introduction to threads -- thread class -- several ways to start threads
Dynamic generation of three-level menu