接口删除资源提示401未授权

主机头加上后Authorization: QBox 依旧提示401
代码如下:

public static  bool DeleteImgToQiniu(string url) 
        {
            bool result = false; 
            Qiniu.Conf.Config.ACCESS_KEY = ACCESSKEY;
            Qiniu.Conf.Config.SECRET_KEY = SECRETKEY;
            CollectHelper collecthelper = new CollectHelper();
            string httpResponse = "";
            string httpParams= Base64URLSafe.Encode(url.Replace("http://7xromb.com1.z0.glb.clouddn.com/",""));
            string httpUrl = "http://rs.qiniu.com/delete/" + httpParams;
            string signingStr = "/delete/" + httpParams;
            string sign = HmacSha1Sign(signingStr, SECRETKEY);
            string encodeBase64 = Base64URLSafe.Encode(sign);
            string accessToken = string.Format("Authorization: QBox {0}:{1}", ACCESSKEY, encodeBase64);
            httpResponse = collecthelper.CollectHtml(httpUrl, httpParams, CollectHelper.Method.POST, CollectHelper.HtmlEncoding.GBK, CollectHelper.HtmlEncoding.UTF8, accessToken);
            if (httpResponse == "") {
                result = true;
            }
            return result;
        }

        public static string HmacSha1Sign(string text, string key)
        {
            Encoding encode = Encoding.GetEncoding("GBK");
            byte[] byteData = encode.GetBytes(text);
            byte[] byteKey = encode.GetBytes(key);
            HMACSHA1 hmac = new HMACSHA1(byteKey);           
            CryptoStream cs = new CryptoStream(Stream.Null, hmac, CryptoStreamMode.Write);
            cs.Write(byteData, 0, byteData.Length);
            cs.Close();
            return Convert.ToBase64String(hmac.Hash);
        }
    
    

collecthelper.CollectHtml(string strHeader) //部分代码如下:

 request.Headers.Add(strHeader)

;

请大神快速回复。谢谢

查看回复