mehran
mehran

Reputation: 1466

asp.net mvc parameter

I 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.

Upvotes: 1

Views: 85

Answers (1)

Daniel Elliott
Daniel Elliott

Reputation: 22857

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

Upvotes: 2

Related Questions