Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
34 Points
16 Posts
Apr 20, 2010 01:11 AM|LINK
Consider the following code snippet:
[AcceptVerbs(HttpVerbs.Post)] public ActionResult TagChange( string tag ) { ... } ... string action = Url.Action( "TagChange" );
Under .NET 3.5 the string action is "http://host/controller/TagChange" as expected but under 4.0 it's null.
Interestingly if I change the UrlHelper.Action call so that it matches the default routing i.e.
string Action = Url.Action( "TagChange", new { id = "foo" } );
I looked at the .NET 4.0 breaking changes and I can't for the life of me see anything that would cause this.
Same version of MVC in both cases, everything identical aside from the targeted framework.
Any ideas? I'd really like to move to 4.0.
EDIT: I can't replicate with a minimum test case :( I'll keep plugging away but if anyone has any ideas please let me know
Nik Coughlin
Member
34 Points
16 Posts
In some cases UrlHelper.Action returns null under .NET 4.0 after working in .NET 3.5
Apr 20, 2010 01:11 AM|LINK
Consider the following code snippet:
[AcceptVerbs(HttpVerbs.Post)] public ActionResult TagChange( string tag ) { ... } ... string action = Url.Action( "TagChange" );Under .NET 3.5 the string action is "http://host/controller/TagChange" as expected but under 4.0 it's null.
Interestingly if I change the UrlHelper.Action call so that it matches the default routing i.e.
string Action = Url.Action( "TagChange", new { id = "foo" } );then the string action is the expected "http://host/controller/TagChange/foo" rather than null.I looked at the .NET 4.0 breaking changes and I can't for the life of me see anything that would cause this.
Same version of MVC in both cases, everything identical aside from the targeted framework.
Any ideas? I'd really like to move to 4.0.
EDIT: I can't replicate with a minimum test case :( I'll keep plugging away but if anyone has any ideas please let me know