Double prompt while File download in ASP.NET

Discussion in 'ASP .Net' started by arc, Aug 10, 2003.

  1. arc

    arc Guest

    I am using this simple code snippet in downloading file but it gives me
    double prompt while opening the file. Save is fine.
    What could be the problem?

    private void Page_Load(object sender, System.EventArgs e)

    {

    string sFilename = Request.QueryString["file"];

    string sFile =
    System.Configuration.ConfigurationSettings.AppSettings["FilePath"] +
    sFilename;

    Response.Clear();

    Response.ContentType = "application/octet-stream";

    Response.AddHeader("content-disposition", "attachment; filename=" +
    sFilename.Substring(sFilename.IndexOf("_")+1));

    Response.Flush();

    Response.WriteFile(sFile);

    }

    Thanks
    Arc
     
    arc, Aug 10, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Xavier Osa
    Replies:
    0
    Views:
    634
    Xavier Osa
    Jan 9, 2004
  2. Sydex
    Replies:
    12
    Views:
    6,500
    Victor Bazarov
    Feb 17, 2005
  3. gaurav kashyap
    Replies:
    2
    Views:
    622
    gaurav kashyap
    Oct 30, 2008
  4. gaurav kashyap
    Replies:
    3
    Views:
    688
    gaurav kashyap
    Oct 31, 2008
  5. arc
    Replies:
    0
    Views:
    113
Loading...

Share This Page