title: How to pass an object from one view to another in ASP.MVC
body: <p>I still don't quite grasp how one can use information in the one cshtml file, gotten from another cshtml file. My program consists out of a gallery. When the user clicks on one of the pictures, instead of simply directing to a page containing only the image url, I would like to redirect to another view that displays the picture and information pertaining to that picture. Here is the relevant code of my faulty attempt:</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>public class HomeController : Controller
  {
      public ActionResult Index()
      {
          var client = new WebClient();
          var response = client.DownloadString(Url.Action("gallery", "photo", null, Request.Url.Scheme));
          var jss = new JavaScriptSerializer();
          var result = jss.Deserialize&lt;List&lt;Photo&gt;&gt;(response);
  
          return View();
      }
      public ActionResult FullImage(Photo m)
      {
          return View();
      }
  }   
  </code></pre>
  
  <p><strong>View:</strong></p>
  
  <pre><code>@section mainContent {
    &lt;ul class="thumbnails"&gt;
      @foreach (var photo in Model)
      {
        &lt;li class="item"&gt;
           &lt;a href='@Url.Action("FullImage", "Home", new {imageUrl="~/photos/" + photo.FileName, title= photo.Title, description= photo.Description})'&gt;
               &lt;img alt="@photo.Description" src="@Url.Content("~/photos/" + photo.FileName)" class="thumbnail-border" width="180" /&gt;
           &lt;/a&gt;
           &lt;span class="image-overlay"&gt;@photo.Title&lt;/span&gt;
        &lt;/li&gt;
      }
    &lt;/ul&gt;
  }
  </code></pre>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>namespace PhotoGallery.Models
  {
      public class Photo
      {
          public string Title { get; set; }
          public string FileName { get; set; }
          public string Description { get; set; }
          public string imageUrl { get; set; }
      }
  }
  </code></pre>