title: get request url after AJAX request
body: <p>I have a search page with link <code>Search?params</code> but any subsequent search requests are made via Ajax forms using Asp.Net. It makes a request to an action with a different name like <code>InstantSearch?params</code> but in the browser I see <code>Search?params</code>.</p>
  
  <p>From this page I have a link to another page and I need to save the Url to return back to this page. </p>
  
  <p>But if I had an AJAX request, Request.Url returns <code>InstantSearch?params</code>, not the link from browser address bar. And the action from this link returns only a Partial View, so when it returns to the previous URL the page is messed up.</p>
  
  <p>How do I get the link of the previous page, from the browser address bar in Asp.Net, not the actual last requested URL?</p>
  
  <p>While searching we are loading masonry containers like this:</p>
  
  <pre><code>$("#main-content-container").load("/Kit/InstantSearch?" + parameters, function() {
          $('#mason-container').imagesLoaded(function() {
              $('#mason-container').masonry({
                  itemSelector: '.kit-thumb-container',
                  columnWidth: 210,
                  isFitWidth: true,
                  gutter: 10
              });
  
  
          });
      });
  </code></pre>
  
  <p>Then I'm calling foundation Joyride on same page and need to pass current page URL to return back. Joyride calls onload of the page under this link:</p>
  
  <pre><code>@Html.ActionLink("Go to kit details help", "OrderPageHelp", "Kit", new { returnUrl = Request.Url }, new { @style = "font-size:16px;" })
  </code></pre>
  
  <p>The needed page return Url is <code>Kit/Search?params</code>, but Request.Url returns that last request when loading masonry with <code>Kit/InstantSearch?params</code>.</p>
  
  <p>How can I pass the needed Url without hard-coding it?</p>