Using MVC to Develop the Project (Cont.)


View (Privacy.cshtml)


C:\ASP.NET-workspace\HelloWorld\Views\Home\Privacy.cshtml
 @{
   ViewData["Title"] = "Privacy Policy";
 }

 <h1>@ViewData["Title"]</h1>

 <p>Use this page to detail your site's privacy policy.</p>

where the code @ViewData["Title"] demonstrates how to retrieve a value from ViewData, which is a way to pass data from a controller to a view. Think of ViewData as a temporary storage container that holds key-value pairs you can use to share information between parts of your application during a single request.




      “Asian women, we live forever.    
      And you know why we’re such bad drivers?    
      Because we’re trying to die.    
      We’re like, 'Yeah! Let me see how invincible I really am!”    
      — Ali Wong