SaveAs dialog not working on server

Discussion in 'ASP.NET / ASP.NET Core' started by sontag, Feb 17, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi,
    I am using Response.Writefile(filename) in my code behind to pop up a save as dialog box to allow users to download mpg files. This works fine on my pc, but it just hangs onthis server. I can create a link to the video and have the media player play the video without any problems. Any ideas?

    Thanks,
    Bill




    protected void Download_Click(object sender, CommandEventArgs e)


    {



    string downloadtarget = e.CommandArgument.ToString();


    System.IO.FileInfo fn =


    new System.IO.FileInfo(Server.MapPath("~/files/") + downloadtarget);


    if (fn.Exists)


    {



    Response.Clear();


    Response.AddHeader("Content-Disposition", "attachment; filename=" + fn.Name);


    Response.AddHeader("Content-Length", fn.Length.ToString());


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


    Response.WriteFile(fn.FullName);


    Response.End();</BLOCKQUOTE>


    }


    else


    {



    DownloadStatus.Visible = true;


    DownloadStatus.Text = "File " + fn + " not found!";</BLOCKQUOTE>


    }</BLOCKQUOTE>


    }
     
  2. Attached is the picture of the File Download I am trying to get displayed. How do others get a File Download dialog to appear?


    Thanks,


    Bill








    Bill

    DevCache Software Services
     

    Attached Files:

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page