ASP.NET Core 2.1: Navigating back to a page after an HTTP POST fails validation displays a browser error

后端 未结 1 1205
傲寒
傲寒 2021-02-08 02:08

Problem:

Using an ASP.NET Core 2.1 MVC project, I\'m receiving the following browser error message after using the browser back button

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-08 02:51

    This is a not a language specific issue. This is a browser behavior. To say this was 'not an issue with ASP.NET MVC 5' is incorrect.

    Solutions: A common method of solving this is the PRG pattern which has been around since 1995.

    An implementation of this for ASP.NET Core, using TempData can be found here

    And I think that this link would be most helpful for you, since it demonstrates a method implemented in both MVC 5 and MVC 6.

    I hope this helps!

    I will try and update this post soon with a sample based on a razor-page starter project, time permitting.

    0 讨论(0)
提交回复
热议问题