Net

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.

tier1tier1
Asp Net Download File From Url

2 Answers

Ashwin ChandranAshwin Chandran

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.

How To Download File From Url

NasheNashe

Asp.net Download File From Url And Save

From

Asp.net C# Download Or Save Image File From Url

Not the answer you're looking for? Browse other questions tagged asp.netbrowserdownloadresponse.write or ask your own question.