Display view as string, then redirect
In my ASP.NET MVC application, I would like my controller action to render a row view, send an email using that string as the body, and then redirect.
I found several articles here on SO and elsewhere on how to render a view for a string. This part was easy.
But when I try to redirect, I get HttpException: Unable to redirect after sending HTTP headers. I tried to set Response.Buffer and Response.BufferOutput to true, I tried Response.Clear, nothing works.
Is it possible to display a string view and then do a redirect?
a source to share
I believe you don't need to end up with a string rendering response.
Have a look here and here (this one has the exact sample you need).
The last link should be:
http://mikehadlow.blogspot.com/2008/06/mvc-framework-capturing-output-of-view_05.html
It seems like StackOverflow is encoding the underline in the linked link. Just make sure you have _05.html at the end.
Also, if I go to the address bar in the browser (after clicking the link), place the cursor there and press Enter.
This is strange.
a source to share