I'm writing a simple test page to download a text file to a browser on button click. I am getting a really strange error that I have never seen before. Any thoughts?
Home / ASP.NET Forums / Advanced ASP.NET / VS Web Deployment Projects / get file name from url get file name from url [Answered] RSS 5 replies. The DownloadFile method downloads to a local file data from the URI specified by in the. When using this method in a middle tier application, such as an ASP. This article is about reading files from a given specific URL using WebClient. String download = Encoding.ASCII.GetString(myDataBuffer); Console.WriteLine(download). ASP.NET CORE - Learn CRUD Operations In Entity Framework Core From Zero To Hero.
The error occures on 'Response.End();' and the file never gets to the client browser
Code:
Error:
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
Just a slight addition to the above solution if you are having problem with downloaded file's name...
This will return the exact file name even if it contains spaces or other characters.