2

I have an MVC project I've been working on in a local Dev environment.

This link is behaving oddly:

@Html.ActionLink("Kindergarten", "GradeKTo5", "WhoAreYou", new { grade = "K" }, null)

Local: http://localhost:3095/WhoAreYou/GradeKTo5/K

Dev: http://redacted.org/WhoAreYou/GradeKTo5?grade=K

I'd like it to work as displayed in local environment. In fact, if I do provide the {controller}/{action}/{grade} formatted URL everything works fine - this is what leads me to believe I'm screwing something up in my use of ActionLink.

In a different partial view, I have the following line of code:

@Html.ActionLink(department.Text, ViewContext.RouteData.Values["Action"].ToString(), "WhoAreYou", new { grade, dept = department.Value }, null)

What am I missing? Why would the same code render querystring values in one environment, but the appropriate route data values on another?

4

0 回答 0