Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to redirect or return file after the successful postback #431

Open
tomasherceg opened this issue Aug 11, 2017 · 8 comments
Open

Allow to redirect or return file after the successful postback #431

tomasherceg opened this issue Aug 11, 2017 · 8 comments

Comments

@tomasherceg
Copy link
Member

When you call Context.Redirect* or Context.ReturnFile, the redirect is performed immediately, so the viewmodel cannot be updated before the browser is instructed to make the download.

We should create another set of methods that would be able to redirect or return a file after the postback is finished.

@tomasherceg
Copy link
Member Author

We should discuss this as part of #835.

@exyi
Copy link
Member

exyi commented May 11, 2020

I actually think that we should have direct support for file downloads and don't do that using a redirect. Even on a first page load, we should support downloading a file or downloading multiple files.

@tomasherceg
Copy link
Member Author

Is there a way to do it without a redirect?

@exyi
Copy link
Member

exyi commented May 13, 2020

Is there a way to do it without a redirect?

By putting a piece of JS into the page :)

@tomasherceg
Copy link
Member Author

Wow, I didn't know JS is that powerful!

But seriously - is there a JS API that can do that? I am not aware of any other method than making a link to the file URL, or redirecting to it. Also, if there is some API that can do that, we should decide what to do with IE11, and also think about the consequences on the postback pipeline (UpdateProgress behavior etc.).

@exyi
Copy link
Member

exyi commented May 14, 2020

Sure, you can make link to that file, and navigate there :) But it does not unload the page, so it's almost a JS API, although it's a hack...

@tomasherceg
Copy link
Member Author

But that's what we do now when you return a file on postback.

Or what did you mean by direct support for file downloads?

@tomasherceg
Copy link
Member Author

The function will be named IncludeFile and can be called multiple times (we'll include multiple file URLs in the response).

@exyi exyi modified the milestones: Version 4.0, Version 4.1 Oct 24, 2021
@exyi exyi modified the milestones: Version 4.1, Version 4.2 Oct 23, 2022
@exyi exyi modified the milestones: Version 4.2, Version 5.0 Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants