I want to save a file on client machine.

i even used the commnad "Path.GetTempPath()" but it gives the address of server's temp folder.

can someone help me?????

Recommended Answers

All 2 Replies

C# runs on the web server. It would be pretty dangerous for web applications to just be able to just save files on a client machine whenever they wanted.
You can either prompt the user to click a link, which then lets the user choose where to save the file, or you can stream the file to the browser and set the content type.
There are also COM / ActiveX objects that can save files to the client, but there are browser issues, of course. Anything that hits the client, hits the browser, when you're talking web apps. At the most basic level, the web application does a bunch of stuff on the web server that generates a static file, which is then sent to the browser over http protocol. By the time the browser sees it, the C# is totally done running and the process has completed.

(I'm assuming this is a web application or you wouldn't be having issues with a server, I wouldn't think)

There may be multiple solutions for what you're trying to do; so, what are you really trying to do? :)

It really is jus common sense... What would internet look like and how long would it last if just about anybody could save any thing on another person's computer. Common sense tells you that the person has to allow you to save the file on his(or hers) computer (, and where exactly).
Am I not right?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.