You cannot save anything on the user's (client's) computer, but the user can save everything.
You got the answer; and not think for a second: in an alternative Universe, where Web application would be able to save anything the developer wants on clients' computers, how many would like to use such kind of Internet? :-)
Now, what is unclear in the error message you get? Look at
System.Web.Mvc.Controller.File
:
Controller.File Method (System.Web.Mvc)[
^].
This is a method. The trouble starts when you add .* to the method's name. I don't think it needs any explanation.
Apparently, you messed it up with
System.IO.File
:
File Class (System.IO)[
^].
And of course its method
WriteAllBytes
could save anything only on the server side, as well as any other methods.
[EDIT]
But it does not mean you cannot deliver any file to the client site. Of course you can; and this is an elementary thing. Actually, the whole purpose of all server-side technology is to do it — to generate some HTTP response on the fly and transmit any data.
But it can be done only on some HTTP request, which you can actually generate of some page, by obvious means. For simplicity, let's assume you create some anchor, so the user clicks on it to receive the file. A trivial way is to create a file on a server side and provide a link on it in that anchor. But, apparently, this is not what you want. The link could be an ASP.NET code which generates HTTP response on the fly. You generate content based on some data, create appropriate header, such as "application/zip" or "application/json" (
Media Types[
^]), write content in the network stream of the HTTP response:
HttpResponse Class (System.Web)[
^],
HttpResponse.ContentType Property (System.Web)[
^],
HttpResponse.ContentEncoding Property (System.Web)[
^],
HttpResponse.OutputStream Property (System.Web)[
^].
[END EDIT]
What can I say? Sorry, but with this level of understanding such thins as syntax, error message, namespaces and other very basic and simple things, and also without the basic idea of what Web does, it's hard to imagine any productive ASP.NET MVC development. Listen to a good friendly advice: learn he basics of language, .NET and general programming first; for this purpose, programming of simplest console-only applications would be the best.
I really cannot understand it. 16 articles with "Legend" status, many of them are on ASP.NET… This post is hard to explain by a little random mistake; the error message is recognized in a second. Are you trying to mystify us?
—SA