Withing a Silverlight Application, how does one get the ID from the URL when using MVC given the URL in the standard MVC Format {controller}/{action}/{id}
Is there anything MVC specific or does one need to parse this URL 'manually'?
Withing a Silverlight Application, how does one get the ID from the URL when using MVC given the URL in the standard MVC Format {controller}/{action}/{id}
Is there anything MVC specific or does one need to parse this URL 'manually'?
Well that's simple, either look in Request.Params["id"] or - and that's more ellegant - add a argument with the name "id" to you Controller method (case does not matter).
public void Index(string id) { }
Works even for more complex objects, the MVC does a good job in retrieving the information and matching it to the arguments of the controller method.
public class Data {
public string ID { get; set; }
}
public void Index(Data data) {
// data.id should be set
}
Silverlight runs on the client, therefore it cannot access the values on the server. However, the sever can pass the info to the client.