Response.Redirect after a Response.Flush

Discussion in 'ASP .Net' started by danielhamd@yahoo.com, Jun 8, 2007.

  1. Guest

    I have a link on an ASP page that loads the Response stream with
    a .vcs file stream and then sends it to the clients machine. This
    opens the calendar entry in their Outlook, etc. However, once this is
    done, I'd like to have the page redirect to a new page that says "You
    have successfully blah blah blah." This doesn't seem to be possible,
    since the response stream has already been sent with the .vcs file.
    Does anyone have any ideas for a clever way around this? I'd like to
    let the user know that everything went smoothly.

    Thanks,
    Daniel
    , Jun 8, 2007
    #1
    1. Advertising

  2. You could use frame set, one frame to deliver the vcs and set a completed
    session variable and one frame to check if the delivery had completed by
    checking the session variable, polling it from the iframe. If your send was
    concluded then you could probably just refresh the frameset with javascript
    an load your message. There might be another eay, but sometime the old
    traditional ways are easiest.

    Regards

    John Timney (MVP)
    http://www.johntimney.com
    http://www.johntimney.com/blog


    "" <> wrote in message
    news:...
    >I have a link on an ASP page that loads the Response stream with
    > a .vcs file stream and then sends it to the clients machine. This
    > opens the calendar entry in their Outlook, etc. However, once this is
    > done, I'd like to have the page redirect to a new page that says "You
    > have successfully blah blah blah." This doesn't seem to be possible,
    > since the response stream has already been sent with the .vcs file.
    > Does anyone have any ideas for a clever way around this? I'd like to
    > let the user know that everything went smoothly.
    >
    > Thanks,
    > Daniel
    >
    John Timney \(MVP\), Jun 8, 2007
    #2
    1. Advertising

  3. wrote:
    > I have a link on an ASP page that loads the Response stream with
    > a .vcs file stream and then sends it to the clients machine. This
    > opens the calendar entry in their Outlook, etc. However, once this is
    > done, I'd like to have the page redirect to a new page that says "You
    > have successfully blah blah blah." This doesn't seem to be possible,
    > since the response stream has already been sent with the .vcs file.
    > Does anyone have any ideas for a clever way around this? I'd like to
    > let the user know that everything went smoothly.
    >
    > Thanks,
    > Daniel
    >


    Why do you want to redirect to a new page, why not just display it on
    the current page?

    You can't use Response.Redirect after anything has been sent to the
    browser, as a redirect replaces the response with a redirection page. If
    you want to go from an existing page to another page you have to use
    Javascript.

    --
    Göran Andersson
    _____
    http://www.guffa.com
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Jun 9, 2007
    #3
  4. That's correct. How about

    Server.Transfer("newpage.aspx?msg=you have successfully...")

    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    Short urls & more: http://ittyurl.net




    "" wrote:

    > I have a link on an ASP page that loads the Response stream with
    > a .vcs file stream and then sends it to the clients machine. This
    > opens the calendar entry in their Outlook, etc. However, once this is
    > done, I'd like to have the page redirect to a new page that says "You
    > have successfully blah blah blah." This doesn't seem to be possible,
    > since the response stream has already been sent with the .vcs file.
    > Does anyone have any ideas for a clever way around this? I'd like to
    > let the user know that everything went smoothly.
    >
    > Thanks,
    > Daniel
    >
    >
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Jun 10, 2007
    #4
  5. Guest

    Server.Transfer also does not work. I would ideally like to modify
    the current page, but that doesn't work either. Any changes I make to
    the page are ignored when I send the file stream to the user's
    browser.

    On Jun 9, 5:57 am, Göran Andersson <> wrote:
    > wrote:
    > > I have a link on an ASP page that loads the Response stream with
    > > a .vcs file stream and then sends it to the clients machine. This
    > > opens the calendar entry in their Outlook, etc. However, once this is
    > > done, I'd like to have the page redirect to a new page that says "You
    > > have successfully blah blah blah." This doesn't seem to be possible,
    > > since the response stream has already been sent with the .vcs file.
    > > Does anyone have any ideas for a clever way around this? I'd like to
    > > let the user know that everything went smoothly.

    >
    > > Thanks,
    > > Daniel

    >
    > Why do you want to redirect to a new page, why not just display it on
    > the current page?
    >
    > You can't use Response.Redirect after anything has been sent to the
    > browser, as a redirect replaces the response with a redirection page. If
    > you want to go from an existing page to another page you have to use
    > Javascript.
    >
    > --
    > Göran Andersson
    > _____http://www.guffa.com
    , Jun 11, 2007
    #5
  6. wrote:
    > Server.Transfer also does not work. I would ideally like to modify
    > the current page, but that doesn't work either. Any changes I make to
    > the page are ignored when I send the file stream to the user's
    > browser.
    >


    I see. Anything that you send to the browser after the .vcs file will be
    treated as garbage data at the end of that file. You can't both send a
    file and an html page in the same response.

    If you want to send a file and also display something in the page, you
    have to open a separate window for the file.

    Example:

    <a href="GetMessage.aspx"
    onclick="window.open('GetVcsFile.aspx','_blank');">

    --
    Göran Andersson
    _____
    http://www.guffa.com
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Jun 12, 2007
    #6
    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. Marina

    Re: Response.Flush() in code-behind

    Marina, Jul 1, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    442
    William F. Robertson, Jr.
    Jul 1, 2003
  2. =?Utf-8?B?TWFydGluIExlZQ==?=

    Calling FormsAuthentication.SignOut() after calling Response.Flush

    =?Utf-8?B?TWFydGluIExlZQ==?=, Sep 28, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    719
    =?Utf-8?B?RXRoZW0gQXp1bg==?=
    Sep 28, 2004
  3. Glen Wilkin via DotNetMonster.com

    Response.Redirect after Response.Flush

    Glen Wilkin via DotNetMonster.com, Apr 15, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    6,890
  4. Sal
    Replies:
    1
    Views:
    381
  5. Richard N.

    Response.Flush / Response.Redirect

    Richard N., Oct 18, 2003, in forum: ASP General
    Replies:
    1
    Views:
    189
    Tom B
    Oct 19, 2003
Loading...

Share This Page