title: .Net MVC: Read master page path from any view
body: <p>I have a method </p>
  
  <pre><code>RenderToString(string pathToView, string pathToMasterPage)
  </code></pre>
  
  <p>which, like the name already says, renders a view and returns the result as a string. Currently I have to pass the path to the master page as a paramter to the method. But since the view itself allready contains the definition of the master page </p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %&gt; 
  </code></pre>
  
  <p>I was wondering if it is possible to read this value programaticly, so that I don't have to pass it as a seperate parameter anymore?</p>