Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 ASP.NET 应用程序中实现“返回搜索结果”的最佳方式是什么?我一直让用户在浏览器中执行 BACK 按钮,但他们总是会收到重新提交表单的提示。
有没有一种有效的方法来解决这个重新提交?
我应该在会话中缓存搜索条件/网址并在他们按下“返回”时重定向它们吗?
这里的最佳做法是什么?
当浏览器历史记录中的页面是 http POST 的直接结果时,您会收到此警告。如果您的搜索表单使用方法 GET 而不是方法 POST,则可以避免这种情况。
我会在查询字符串中传递搜索条件,并将反向链接<a href='/Search.aspx?q=keywords'>Back</a>改为类似的东西。
<a href='/Search.aspx?q=keywords'>Back</a>