Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

MVC Action name exposed when javascript disabled


We're working on an MVC application at the moment and we're running into some issues with our URL's.

We have two simple action methods in a controller:

public PartialViewResult Index(ListingPagePress currentPage)
        var model = new ListingPagePressViewModel(currentPage);

        var pressReleaseChildren = GetData(currentPage, 0);
        model.PressReleasePages = pressReleaseChildren;
        model.TotalPages = 3;

        return PartialView(model);

    public PartialViewResult PressReleaseList(ListingPagePress currentPage, int pageNo)
        IEnumerable<>PressReleasePageViewModel> data = GetData(currentPage, pageNo);
        return PartialView(data);

The PressReleaseList is rendered using an action (on the index view), i.e.:

@Html.Action("PressReleaseList", new { pageNo = 0 })

and then we have some simple pagination (again on the index view):

@for (var i = 0; i <> Model.TotalPages; i++)
@Ajax.ActionLink(i.ToString(), "Index",
        new { pageNo = i },
        new AjaxOptions
            UpdateTargetId = "pressReleaseTable",
            OnBegin = "OnAjaxRequestBegin",
            OnFailure = "OnAjaxRequestFailure",
            OnSuccess = "OnAjaxRequestSuccess",
            OnComplete = "OnAjaxRequestComplete"

The unobtrustive ajax is working just fine. The problem is, if the client has javascript disabled they end up navigating to the partialview via a horrid url such as:

Whereas we want to retain the true URL structure which would be:

How do we acheive this? Is mapping a route the only possibility? That would be quite hard fro us because we're working with a CMS, so we never know what the exact url prefix would be because the User could change the url of "press-releases".

Any advice would be greatly appreciated

Sep 02, 2014 17:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.