【问题标题】:PasteBin API can't paste code with '&'PasteBin API 无法粘贴带有“&”的代码
【发布时间】:2012-02-03 14:48:08
【问题描述】:

我正在使用 PASTEBIN api 来粘贴一些 C# 代码。一切正常,除了当我的代码包含“&”时,这对我来说听起来很奇怪,因为我使用的是Uri.EscapeUriString。这里是创建我的有效载荷的代码:

private byte[] GetUploadData(string key, string s, string lang)
    {
        var payload = string.Join("&", new string[]
       {
           "api_option=paste"
           ,"api_dev_key=1234567890000000000000000000"
           ,"api_user_key="+login
           ,"api_paste_code="+Uri.EscapeUriString(s)
           ,"api_paste_expire_date=N"
            ,"api_paste_format="+lang
            ,"api_paste_name="+Uri.EscapeUriString(key)
            ,"api_paste_private = 0"

       }
        );
        return System.Text.Encoding.UTF8.GetBytes(payload);
    }

当代码包含“&”时,它会被截断。 有什么问题?

【问题讨论】:

    标签: c# api pastebin


    【解决方案1】:

    改用 Uri.EscapeDataString

    【讨论】:

      猜你喜欢
      • 2012-10-14
      • 2014-08-11
      • 2014-03-15
      • 2012-10-24
      • 2011-05-24
      • 2011-02-22
      • 2016-06-13
      • 2013-02-25
      • 1970-01-01
      相关资源
      最近更新 更多