asp.net mvc parameter
I 开发者_Python百科want to display a prompt message when he is redirceted from a special page, how can accomplish this? Passing messsage as paramater is not so pretty. a used a booling paramater to determinig situation to display message.
Why not pass the boolean in ViewData
(whether to display the message) based upon interrogating Request.ServerVariables["http_referer"]
in your controller?
in controller
ViewData["DisplayMessage"] =
Request.ServerVariables["http_referer"] == "http://Special.com";
in view
<% if ((bool)ViewData["DisplayMessage"])){ %>
<div>YOUR MESSAGE</div>
<% } %>
Kindness,
Dan
精彩评论