加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – .NET MVC API – get请求中的点(句点)

发布时间:2020-12-16 00:08:38 所属栏目:百科 来源:网络整理
导读:我正在尝试设置Facebook Notification API. 我有一个带有RealtimeUpdate()的APi控制器 – Get,将仅用于验证端点. 正如Fb Docs中所写: Firstly,Facebook servers will make a single HTTP GET to your callback URL when you try to add or modify a subscri
我正在尝试设置Facebook Notification API.
我有一个带有RealtimeUpdate()的APi控制器 – Get,将仅用于验证端点.

正如Fb Docs中所写:

Firstly,Facebook servers will make a single HTTP GET to your callback
URL when you try to add or modify a subscription. A query string will
be appended to your callback URL with the following parameters:

  • hub.mode – The string “subscribe” is passed in this parameter
  • hub.challenge – A random string
  • hub.verify_token – The verify_token value you specified when you created the subscription

从这里我有一个问题 – 我不知道如何在查询参数名称中处理这些点.我谷歌很多,并没有找到解决方案.

有人可以告诉我如何从这个中心获取数据.*值?

谢谢!

解决方法

使用FromUri属性更新方法签名,如下所示:

public string Get(
    [FromUri(Name="hub.mode")]string mode,[FromUri(Name="hub.challenge")]string challenge,[FromUri(Name="hub.verify_token")]string verifyToken
    )
{
    /* method body */
}

将使用指定的名称从查询字符串绑定参数.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读