Rendering a view to a string in MVC, then redirecting — workarounds?

后端 未结 3 1783
轻奢々
轻奢々 2021-01-14 03:14

I can\'t render a view to a string and then redirect, despite this answer from Feb (after version 1.0, I think) that claims it\'s possible. I thought I was doing something w

3条回答
  •  孤街浪徒
    2021-01-14 03:54

    Here is an alternative method for rendering a view to a string that never results in data being output to the response (therefore it should avoid your problem): http://craftycodeblog.com/2010/05/15/asp-net-mvc-render-partial-view-to-string/

    To render a regular view instead of a partial view, you'll need to change "ViewEngines.Engines.FindPartialView" to "ViewEngines.Engines.FindView".

提交回复
热议问题