views:

612

answers:

1

In ASP.NET MVC how can I generate a URL to a specific controller and action along with other parameters. The RedirectToAction allows me to redirect, but I would like to retrieve this URL instead from within my controller.

I tried using:

Url.Action("Page", "Administrator", New With {.page = _currentPage})

But that returned a link like /Administrator/Page?page=2 whereas I was hoping to retrieve something like /Administrator/Page/2

I've searched countless forums and I'm sure there is something around for this, but I cannot find it for the life of me.

Thanks!

+2  A: 

What do your routes look like? The standard route expects an id as the third parameter. If you haven't changed your routes, try using:

Url.Action( "Page", "Administrator", New With { id = _currentPage } )
tvanfosson
Agreed. It looks like this is why.
çağdaş