将查询字符串映射到action方法包含特殊字符 [英] mapping querystring to action method contains special character

查看:125
本文介绍了将查询字符串映射到action方法包含特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在具有查询字符串的WEB api中注册路由 product-Id:347DCYA3-FE25DW8350 我将此作为字符串在action方法的参数中。 我无法映射到下面的操作方法。

你能帮助我吗

这是路线配置



How we can register a route in WEB api having query string is product-Id:347DCYA3-FE25DW8350 i taken this as string in the parameter of the action method. i cannot map to the below action method .
Can you help me
this is the route configuration

config.Routes.MapHttpRoute("product", "product/{productId}", new { controller = "product", action = "get" });





route





route

routes.MapRoute("Default", "{controller}/{productId}", new { controller = "product",

action = "get", id = UrlParameter.Optional });





in controller [httpget]



in controller [httpget]

public void get (string productId) { }

推荐答案

这篇关于将查询字符串映射到action方法包含特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆