temporary-asp.net-files

Creating a text file on the fly and have it download/save on client side

[亡魂溺海] 提交于 2019-12-08 01:08:51
问题 In our ASP.NET Core 1.1, EF Core 1.1 app we have populated a string with some data from SQL Server and would like to have a text file created out of it on the fly and have a user save/download from the client side. In old days we used to do it as follows: List<string> stringList = GetListOfStrings(); MemoryStream ms = new MemoryStream(); TextWriter tw = new StreamWriter(ms); foreach (string s in stringList) { tw.WriteLine(s); } tw.Flush(); byte[] bytes = ms.ToArray(); ms.Close(); Response

Creating a text file on the fly and have it download/save on client side

大兔子大兔子 提交于 2019-12-06 10:22:35
In our ASP.NET Core 1.1, EF Core 1.1 app we have populated a string with some data from SQL Server and would like to have a text file created out of it on the fly and have a user save/download from the client side. In old days we used to do it as follows: List<string> stringList = GetListOfStrings(); MemoryStream ms = new MemoryStream(); TextWriter tw = new StreamWriter(ms); foreach (string s in stringList) { tw.WriteLine(s); } tw.Flush(); byte[] bytes = ms.ToArray(); ms.Close(); Response.Clear(); Response.ContentType = "application/force-download"; Response.AddHeader("content-disposition",

How to determine the \Temporary ASP.NET Files\root\{site hash} with PowerShell?

ε祈祈猫儿з 提交于 2019-12-05 00:30:42
问题 ASP.NET makes use of a temporary files directory to store files for Shadow Copying and Dynamic Compilation. A typical path will look like this. Note the hash on the end of the path. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\{hash} I'm using automated deployments and have noticed that these folders and their contents are not automatically removed. I'd like to automate the process of removing unused temp files as part of my deployment process. Such that as soon