Ejemplo n.º 1
0
        private void processQQWeibo()
        {
            WeiboType type = WeiboType.GetByName("qqweibo");
            if (type == null) return;

            OauthKey key = new OauthKey(type.AppKey, type.AppSecret);
            bool success = false;
            try
            {
                string callback = ctx.url.SiteUrl.TrimEnd('/') + to(new UserWeiboSettingController().QQWeiboCallback);
                success = key.GetRequestToken(callback);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
            if (success)
            {
                ctx.web.SessionSet("qqweibo", key);
                redirectUrl(key.GetOAuthUrl());
            }
            else
            {
                echoRedirect("操作失败,请重试");
            }
        }
Ejemplo n.º 2
0
 private void processQQWeibo(WeiboType type)
 {
     OauthKey key = new OauthKey(type.AppKey, type.AppSecret);
     bool success = false;
     try
     {
         string callback = ctx.url.SiteUrl.TrimEnd('/') + to(QQWeiboCallback);
         success = key.GetRequestToken(callback);
     }
     catch (Exception ex)
     {
         log.Error(ex.Message);
     }
     if (success)
     {
         ctx.web.SessionSet("qqweibo", key);
         redirectUrl(key.GetOAuthUrl());
     }
     else
     {
         echoRedirect("操作失败,请重试");
     }
 }