Response.Redirect : default file name

Discussion in 'ASP .Net' started by mamin@o2.pl, Oct 9, 2006.

  1. Guest

    Hi,
    Im trying to send bmp file to client using Internet Explorer 6.0. So my
    code is:


    string bmpFilePath=@"c:\1.bmp";
    Response.ContentType="application/bmp";
    Response.AppendHeader("","attachment; filename=\"" + bmpFilePath +
    "\"");
    Response.WriteFile(bmpFilePath);
    Response.Flush();
    Response.End();

    The problem is, that when cient is saving this file, the default name
    for this file is not 1.bmp but the same as my aspx for example
    WebForm1.aspx . How to change it?
     
    , Oct 9, 2006
    #1
    1. Advertising

  2. You need to add the header name, "content-disposition", .e.g.

    Response.AppendHeader("content-disposition", "attachment;
    filename=1.bmp");

    wrote:
    > Hi,
    > Im trying to send bmp file to client using Internet Explorer 6.0. So my
    > code is:
    >
    >
    > string bmpFilePath=@"c:\1.bmp";
    > Response.ContentType="application/bmp";
    > Response.AppendHeader("","attachment; filename=\"" + bmpFilePath +
    > "\"");
    > Response.WriteFile(bmpFilePath);
    > Response.Flush();
    > Response.End();
    >
    > The problem is, that when cient is saving this file, the default name
    > for this file is not 1.bmp but the same as my aspx for example
    > WebForm1.aspx . How to change it?
     
    Chris Fulstow, Oct 9, 2006
    #2
    1. Advertising

  3. Guest

    > Response.AppendHeader("content-disposition", "attachment;
    > filename=1.bmp");


    It doesn't work.Default name for transmitted file is still
    WebForm1.aspx. Anyone knows why?
     
    , Oct 10, 2006
    #3
  4. Guest

    Sorry,my mistake. Now it works perfectly!
    Thanks for help.
     
    , Oct 10, 2006
    #4
    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. Charles A. Lackman
    Replies:
    2
    Views:
    8,020
    Charles A. Lackman
    Jan 11, 2006
  2. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,260
    Srowe1975
    Oct 15, 2008
  3. Sal
    Replies:
    1
    Views:
    545
  4. Ron Howard
    Replies:
    2
    Views:
    528
    Ron Howard
    Aug 11, 2004
  5. Me
    Replies:
    2
    Views:
    216
Loading...

Share This Page