ASP.NET MVC F# controller action ignoring parameter?

The problem is that the name of the parameter of the controller needs to match the name specified in the mapping that specifies how to translate the URL to a controller call If you look into the Global.asax. Cs file (which you should be able to translate to F# too), then you would see something like this: routes. MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.

Optional } // Parameter defaults ) The name id specifies the expected name of the parameter, so you need to adjust the F# code to take a parameter named id like this: member x. Index(id:int) = x.ViewData. "Message" ActionResult You can use NullableNET MVC relies on so many dynamic tests that aren't checked at compile-time.

I would hope that one day, there will be some nicer web framework for F# :-).

The problem is that the name of the parameter of the controller needs to match the name specified in the mapping that specifies how to translate the URL to a controller call. If you look into the Global.asax. Cs file (which you should be able to translate to F# too), then you would see something like this: routes.

MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter. Optional } // Parameter defaults ); The name id specifies the expected name of the parameter, so you need to adjust the F# code to take a parameter named id like this: member x. Index(id:int) = x.ViewData."Message" ActionResult You can use Nullable type if you want to make the parameter optional.

For a programmer used to the static type safety provided by F#, it is somewhat surprising that ASP. NET MVC relies on so many dynamic tests that aren't checked at compile-time. I would hope that one day, there will be some nicer web framework for F# :-).

Dang it! I completely forgot about that. I so was convinced that it was an F#-related problem that I forgot to go back to the ASP.NET MVC basics.

Thanks alot! – Matt H May 3 '10 at 1:31.

That was it -- thanks! – Matt H May 3 '10 at 1:32.

The problem is that the name of the parameter of the controller needs to match the name specified in the mapping that specifies how to translate the URL to a controller call. You can use Nullable type if you want to make the parameter optional. For a programmer used to the static type safety provided by F#, it is somewhat surprising that ASP.NET MVC relies on so many dynamic tests that aren't checked at compile-time.

I would hope that one day, there will be some nicer web framework for F# :-).

The problem is that the name of the parameter of the controller needs to match the name specified in the mapping that specifies how to translate the URL to a controller call.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions