How do I save text file to client computer in ASP.NET?

Posted on 2011-05-09
Last Modified: 2012-05-11
I create text doc in my .net page that saves to a location on my server.  How do I pop up a dialog for the user to choose the save location, then pass it to my code here:
       TextWriter tw = new StreamWriter(@"C:\Deliverables\" + Request.QueryString["j"].ToString().Trim() + @"\" + Request.QueryString["j"].ToString().Trim() + ".txt");
        tw.WriteLine("File Name\tWriters\tPublishers");
Question by:JT_SIRO
    LVL 9

    Assisted Solution

    Redirect to the file location on your server... see this post for examples:
    LVL 11

    Accepted Solution

    Hi, this example is useful to you

    private void BtnFind_Click(object sender, System.EventArgs e)
            StreamReader sr = new StreamReader(this.TxtFilename.Text);
            Msg.Visible = true;
            Msg.Text = "File "+ this.TxtFilename.Text +" was found";
        catch(Exception ex)
            CreateLogFiles Err = new CreateLogFiles();
            Msg.Visible = true;
            Msg.Text = "Fatal error : "+ ex.Message + ", please find a complete error at ErrorLog file";

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now