Web/app/sina/oauth.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OAuth.Sina;
using Common;
namespace Web.App.Sina
{
    public partial class oauth : Web.UI.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //CheckOAuthState("sina");
            //if (!site.AllowReg || site.CheckReg)
            //{
            //    FinalMessage("对不起,本站不支持第三方登录!", site.Dir, 0);
            //    Response.End();
            //}
            string _operType = q("type");
            string _operMode = q("mode") == "" ? "thirdlogin" : q("mode");
            switch (_operType)
            {
                case "login"://登陆
                    string strXmlFile = HttpContext.Current.Server.MapPath("~/XmlConfig/oauth_sina.config");
                    DBUtility.XmlControl XmlTool = new DBUtility.XmlControl(strXmlFile);
                    SinaConfig.AppKey = XmlTool.GetText("Root/AppKey");
                    SinaConfig.AppSecret = XmlTool.GetText("Root/AppSecret");
                    XmlTool.Dispose();
                    SinaConfig.CallBackURI = SiteConfig.WebUrl + "app/sina/oauth.aspx?type=logined&mode=" + _operMode;
                    new OAuth.Sina.SinaApi().ConnectSina();
                    break;
                case "logined"://登陆后
                    if (!string.IsNullOrEmpty(Request["oauth_verifier"]))
                    {
                        new OAuth.Sina.SinaApi().getAccessToken(Request["oauth_verifier"].ToString());
                    }
                    SinaApi sinaApi = new SinaApi();
                    SinaUser SinaUser = sinaApi.verify_credentials();
                    if (SinaUser == null)
                    {
                        string _html2 = @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
<html xmlns=""http://www.w3.org/1999/xhtml"">
<head>
    <title></title>
</head>
<body>
error_code=" + Request["error_code"] + @"
</body>
</html>";
                        Response.Write(_html2);
                        return;
                    }
                    if (_operMode == "sendweibo")
                    {
                        Response.Redirect("weibo.aspx");
                        Response.End();
                    }
                    string _Access_Token = SinaUser.id.ToString();
                    if (_Access_Token != "")
后面还有 13 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。