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. Advertisements

  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. Advertisements

  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. Advertisements

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,461
    Charles A. Lackman
    Jan 11, 2006
  2. Matthew Wieder

    Response.Write and Response.Redirect

    Matthew Wieder, Jul 17, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    971
    Kevin Spencer
    Jul 17, 2003
  3. Sehboo
    Replies:
    3
    Views:
    9,512
    Sehboo
    Dec 10, 2003
  4. S.Kartikeyan
    Replies:
    0
    Views:
    3,090
    S.Kartikeyan
    Mar 1, 2004
  5. =?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:
    6,206
    Srowe1975
    Oct 15, 2008
  6. Sal
    Replies:
    1
    Views:
    1,700
  7. Ron Howard
    Replies:
    2
    Views:
    797
    Ron Howard
    Aug 11, 2004
  8. Me
    Replies:
    2
    Views:
    283
Loading...