开发者

What is wrong with this call to the Controller's Action method

When I Redirect user to this Url

http://localhost:34768/Module/Ed开发者_如何学Cit?versionId=f4592b62-17e4-47e1-8a08-6a927a1c895e?selectedTab=0&selectedRowId=4c1fb4a6-691f-4c03-9e67-8f8b10a95c0e

I'll get following error:

The parameters dictionary contains a null entry for parameter 'versionId' of non-nullable type 'System.Guid' for method 'System.Web.Mvc.ActionResult Edit(System.Guid, System.Nullable1[System.Int32], System.Nullable1[System.Guid], System.String)' in 'ParKone.Controllers.ModuleController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters

My controller action looks like this:

public ActionResult Edit(Guid versionId, int? selectedTab, Guid? expandedRowId, string url = "")

I don't understand why versionId is not coming through. If I write this Url then it works smoothly.

http://localhost:34768/Module/Edit?versionId=f4592b62-17e4-47e1-8a08-6a927a1c895e

Any ideas?

Update

I have this kind of line in the Web.config

<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" />


You have two ?'s in your url and so the routing is picking up your parameters from the second ?. The ? is used as a separator of your parameters and your URL and so it seems that the routing takes the parameters, in this case, from the portion of the querystring after the second ?.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜