Insert current URL into @Html.RouteLink parameter to build a link
<p>I am probably going about this the wrong way as i'm a noob to .NET MVC, but is there a way to insert the current url as a parameter into an @Html.Routelink?</p>

<p>I'm passing a partial view into a page to display a list of subcategories based off of the current category. </p>

<p>Here is my controller logic: </p>

<pre><code>   public PartialViewResult SubcategoryMenu(string category)
    {
        IEnumerable&lt;string&gt; subcategories = repository.Products
            .Where(x =&gt; x.SubCategory.Category.CategoryName == category)
            .Select(x =&gt; x.SubCategory.SubCategoryName)
            .Distinct()
            .OrderBy(x =&gt; x);

        return PartialView(subcategories);
    }
</code></pre>

<p>Here is my partial view which I'm trying to get the current category url into:</p>

<pre><code>@model IEnumerable&lt;string&gt;
@foreach (var link in Model)
    {
        @Html.RouteLink(link, new
            {
                controller = "Product",
                action = "List",
                category = "INSERT CURRENT URL HERE",
                subcategory = link,
                page = 1
             }, new { @class = "btn btn-block btn-default btn-lg" })
     }
</code></pre>

<p>When the page displays, all products and categories are listed, no problem.  When I click a Category, the URL is <code>http://localhost/Category2</code> which is what I want.</p>

<p>Click a category, then all of the associated subcategories display in a separate div based on the linq query in the controller just fine.</p>

<p>However, to properly display the products, the url generated for the subcategory view needs to be <code>http://localhost/Category/Subcategory</code> and no matter how I tweek the @Html.RouteLink or even an @Html.Actionlink, all I can get is <code>http://localhost/Subcategory</code> If i pass in text into the @Html.Routelink for controller= "something" that will display <code>http://localhost/something/Subcategory</code> so I've been trying to get the current URL which matches the required category passed into the subcategory @Html.Routelink with no success.</p>

<p>If there is a way to insert the current URL into the subcategory RouteLink it would solve my woes.  If there is a way to accomplish, or a better way to do so, please help.  </p>

<p>Thank you all!</p>