Click here to Skip to main content
15,850,548 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How i can send to a txt file, into a folder on the C drive on a client pc, its a web app in c #
Updated 29-Nov-12 7:23am
gilvani 29-Nov-12 11:05am    
When you find the solution please tell me. I Think thats is impossible with javascript or this is only possible with silverlight or java applet.
joshrduncan2012 29-Nov-12 12:19pm    
What is your question? Have you attempted this yet?


As far as I know there is no easy solution to write directly a file on the client PC. This actually makes sense as it is a security issue, virus writer would love that feature!

What you can do is popup a save as dialog that asks the user to save a file.

Here is an example of how you can do this:

protected void ButtonGetPeople_Click(object sender, EventArgs e)
    Response.AddHeader("content-disposition", "attachment; filename=" + _exportfileName);
    Response.AddHeader("content-type", "text/csv");

    using (StreamWriter writer = new StreamWriter(Response.OutputStream))
        // ... export all the data....

Share this answer
This is possible when you are use activex in page for read or write file on client PC. It's work.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900