Response.Write and Response.Redirect

Discussion in 'ASP .Net' started by slawekg, Jun 21, 2007.

  1. slawekg

    slawekg Guest

    Hi!
    I'm doing these steps:
    -user do some fields filling and click a button
    -procedure is fired, it returns some data, I change it to csv file
    -I use Response.Write to send file to the user

    What I would like to achieve is that AFTER user would get file, he would be
    redirected to another page.
    I tried it by all known to me ways and I searched the web and found it's not
    possible to Response.Redirect after Response.Write [ all under one button ].
    Does anybody has any solution to such situation?
    with regards,
    sg
    slawekg, Jun 21, 2007
    #1
    1. Advertising

  2. On Jun 21, 11:17 am, "slawekg" <> wrote:
    > Hi!
    > I'm doing these steps:
    > -user do some fields filling and click a button
    > -procedure is fired, it returns some data, I change it to csv file
    > -I use Response.Write to send file to the user
    >
    > What I would like to achieve is that AFTER user would get file, he would be
    > redirected to another page.
    > I tried it by all known to me ways and I searched the web and found it's not
    > possible to Response.Redirect after Response.Write [ all under one button ].
    > Does anybody has any solution to such situation?
    > with regards,
    > sg


    Open the file in a new window.
    Alexey Smirnov, Jun 21, 2007
    #2
    1. Advertising

  3. slawekg

    slawekg Guest

    > Open the file in a new window.
    Yes, but other than that?
    slawekg, Jun 21, 2007
    #3
  4. On Jun 21, 2:54 pm, "slawekg" <> wrote:
    > > Open the file in a new window.

    >
    > Yes, but other than that?


    First of all, I don't think that this idea is good for the user. What
    should happen if user opened the file, or stopped download it?

    Regarding redirect. It sends to a browser HTTP 302 response code. When
    you do it after Response.Write the server has already sent a "200"
    header, and you will get an error about not being able to modify the
    headers. One thing I forgot to mention, there is a Server.Transer
    method, did you tried it?
    Alexey Smirnov, Jun 21, 2007
    #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:
    7,976
    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:
    678
    Kevin Spencer
    Jul 17, 2003
  3. Sehboo
    Replies:
    3
    Views:
    8,763
    Sehboo
    Dec 10, 2003
  4. =?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,221
    Srowe1975
    Oct 15, 2008
  5. Sal
    Replies:
    1
    Views:
    380
Loading...

Share This Page