ASP.NET TempData persists between requests

前端 未结 2 774
[愿得一人]
[愿得一人] 2020-12-11 16:52

I am using temp data as follow in my controllers - very simple, when there is a problem:

TempData(\"StatusMessage\") = \"You have no items set to Auto-Ship.\         


        
2条回答
  •  温柔的废话
    2020-12-11 17:02

    would this be acceptable (removing the error once it has been shown):

    <%  If TempData.ContainsKey("ErrorMessage") Then %>
    
    

    <%=TempData("ErrorMessage") %>

    <% TempData.Remove("ErrorMessage") End If %>

提交回复
热议问题