title: Routing in MVC, "Specify a root relative path with a leading '/'"
body: <p>I had a razor page called Submit that was giving me a <code>Value cannot be null. Parameter name : viewData</code> error so I removed the <code>@page</code> at the top of my code as <a href="https://stackoverflow.com/questions/49917232/argumentnullexception-value-cannot-be-null-parameter-name-viewdata">this</a> post directed. My issue now is that when I load the page I the following error:</p>
  <blockquote>
  <p>InvalidOperationException: The relative page path 'Index' can only be used while executing a Razor Page.  Specify a root relative path with a leading '/' to generate a URL outside of a Razor Page. If you are using LinkGenerator then you must provide the current HttpContext to use relative pages.&gt;</p>
  </blockquote>
  <p>I want my page to have a URL of <code>https://localhost:44369/Submit</code> How would I do this? Here is my routing in my Startup.cs file:</p>
  <pre><code> app.UseMvc(routes =&gt;
       {
          routes.MapRoute(&quot;default&quot;, &quot;{controller=Home}/{action=Index}/{id?}&quot;);
       });
  </code></pre>