title: How to navigate from one controller to another controller MVC
body: <p>i am trying to learn mvc. suppose i have two links in my index page. i want that when i will click on first link then i want MyPageOneController should invoke and MyPageOne view should display.</p>
  
  <p>the same way i want that when i will click on second link then i want MyPageTwoController should invoke and MyPagetwo view should display.</p>
  
  <p>i try to do it but getting error. here i am giving the pic of my controller &amp; view folder structure. just have a look.</p>
  
  <p><img src="https://i.stack.imgur.com/9Vq8V.png" alt="enter image description here"></p>
  
  <p>i have one view called MyPageOne which is in home folder and another view in different folder called test.</p>
  
  <h2>here i am giving my full code</h2>
  
  <p><strong>Index.cshtml code</strong></p>
  
  <pre><code>@{
      ViewBag.Title = "Home Page";
  }
  
  &lt;h2&gt;@ViewBag.Message&lt;/h2&gt;
  &lt;p&gt;
      @Html.ActionLink("Click on link one", "MyPageOne", "MyPageOne")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      @Html.ActionLink("Click on link two", "MyPageTwo", "MyPageTwo")
  &lt;/p&gt;
  </code></pre>
  
  <p><strong>MyPageOne.cshtml code</strong></p>
  
  <pre><code>@{
      ViewBag.Title = "MyPageOne";
  }
  
  &lt;h2&gt;Welcome to MyPageOne !&lt;/h2&gt;
  </code></pre>
  
  <p><strong>MyPageTwo.cshtml</strong></p>
  
  <pre><code>@{
      ViewBag.Title = "MyPageTwo.cshtml";
  }
  
  &lt;h2&gt;Welcome to MyPageTwo !&lt;/h2&gt;
  </code></pre>
  
  <p>i have created two controllder called MyPageOneController.cs &amp; MyPageTwoController.cs</p>
  
  <p><strong>code in MyPageOneController.cs</strong></p>
  
  <pre><code>namespace MvcApplication4.Controllers
  {
      public class MyPageOneController : Controller
      {
          //
          // GET: /MyPageOne/
  
          public ActionResult MyPageOne()
          {
              return View();
          }
  
      }
  }
  </code></pre>
  
  <p><strong>code in MyPageTwoController.cs</strong></p>
  
  <pre><code>namespace MvcApplication4.Controllers
  {
      public class MyPageTwoController : Controller
      {
          //
          // GET: /MyPageTwo/
  
          public ActionResult MyPageTwo()
          {
              return View();
          }
  
      }
  }
  </code></pre>
  
  <p>so just guide me what is wrong. i check that when i click on first link then right controller method is getting called but no view is not getting render. where i am making mistake. please guide me what i need to change in my code to load two view created by me and stored in two different folder. thanks</p>
  
  <h2>I got the solution</h2>
  
  <pre><code>public ActionResult MyPageOne()
          {
              return View("../Home/MyPageOne");
          }
  
   public ActionResult MyPageTwo()
          {
              //return View();
              return View("../Test/MyPageTwo");
          }
  </code></pre>
  
  <p>this way i redirect to the view and job done.
  can u plzz tell me how could i specify programmatically something under view folder.
  i use the code  <code>return View("~/Home/MyPageOne");</code> but it did not work. how to mention root view folder path??</p>
  
  <p>thanks</p>