七牛云存储 上传 私钥下载
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Qiniu.Conf;
using Qiniu.IO.Resumable;
using System.Collections.Specialized;
using Qiniu.RS;
using Qiniu.RPC;
namespace bootstrapLearn
{
  public partial class qiniutest : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void bt_ServerClick(object sender, EventArgs e)
    {
      Qiniu_API.PutFile(ff.Value, Guid.NewGuid().ToString("N") + "aa");
    }
  }
  public static class Qiniu_API
  {
 public static string Bucket = "pengbg";//空间名
        public static string Domain = "7sbrz8.com1.z0.glb.clouddn.com";//域名
    /// <summary>
    /// 
    /// </summary>
    /// <param name="path">本地路径</param>
    /// <param name="fileName">文件名</param>
    /// <returns></returns>
    public static bool PutFile(string path, string fileName)
    {
      bool flag = false;
      Settings putSetting = new Settings();
      ResumablePutExtra extra = new ResumablePutExtra();
      NameValueCollection nc = new NameValueCollection();
      nc.Add("x:username", "qiniu");
      extra.CallbackParams = nc;
      ResumablePut target = new ResumablePut(putSetting, extra);
      string upToken = new PutPolicy(Bucket).Token(new Qiniu.Auth.digest.Mac());
      string key = fileName;
      target.PutFinished += new EventHandler<CallRet>((o, e) =>
      {
        if (e.OK)
        {
          flag = true;
        }
      });
      CallRet ret = target.PutFile(upToken, path, key);
      return flag;
    }
    static Qiniu_API()
    {
      Config.ACCESS_KEY = "";  //AK
      Config.SECRET_KEY = "";//SK
    }
} }
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="qiniutest.aspx.cs" Inherits="bootstrapLearn.qiniutest" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> </head> <body> <form id="form1" runat="server"> <input type="file" runat="server" id="ff" /> <input type="button" runat="server" value="上传" id="bt" onserverclick="bt_ServerClick" /> </form> </body> </html>

转自: http://www.cnblogs.com/hjwtech/p/3927277.html
实名认证之后 终于可以 私钥 下载啦。
//私钥 下载 //其实很简单 这个官方的方法 就是告诉我们 MakeRequest 方法 就是 七牛 帮你 生成一个 会变动的 私钥 链接 // 监视 下 private_url 就知道 了。本次会话 地址不变 ,下次会话 就是 一个新的地址了 // eg: Qiniu_API.MakeGetToken("7tszrc.com1.z0.glb.clouddn.com", "ee2c666979366c6f6e670e09.jpg"); public static void MakeGetToken(string domain, string key) { string baseUrl = GetPolicy.MakeBaseUrl(domain, key); // 这个 MakeBaseUrl 不就是 字符串 拼接么! 得到 如下 结果: //http://7tszrc.com1.z0.glb.clouddn.com/ee2c666979366c6f6e670e09.jpg string private_url = GetPolicy.MakeRequest(baseUrl); }
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号