Addressed code review comments.

- Changed the RazorPage writing scopes to replace the entire ViewContext.Writer to ensure that we capture content from Html.BeginForm etc.
- Added a test to cover the ViewContext.Writer redirection scenario.