title: Dynamic logo image in layout page using MVC
body: <p>I am just making simple web app where a user can upload logo image file to be placed in layout page using MVC.
  If a user uploads a new logo image file, it will replace previous one and will show up upon next refresh. But I don't know which way is elegant.</p>
  
  <p>For now, when user uploads logo image, local path for image and related information are saved in database. </p>
  
  <p>In layout page,</p>
  
  <pre><code> &lt;img src="@Url.Action("GetLogo","BaseController")" alt="Logo"/&gt;
  </code></pre>
  
  <p>The action "GetLogo" the saved local path is retrieved from database and returns FileContentResult like below</p>
  
  <pre><code> public FileContentResult GetLogo(string param)
   {
      //retrieving path from db
      //return new FileContentResult(bytes, "image");
   }
  </code></pre>
  
  <p>This works fine now. But it seems less efficient because every time user moves, layout page is refreshed too and has to go do some db query to get path infomation. </p>
  
  <p>The other way I could think was that static file name should be used like below.</p>
  
  <pre><code>&lt;img src="@Url.Content("~/Content/logo.png")" alt="Logo"/&gt;
  </code></pre>
  
  <p>So when user uploads new logo file, server will have to change the name of the new logo image file to logo.png. But I am not sure it will work when user uploads different file types such as jpeg and gif. </p>
  
  <p>The db query may not be a burden in terms of server. So I may stick to using first approach. But I am not sure. 
  If any of experienced guys can give me any tip, I would really appreciate it. 
  Thanks,</p>