Login.aspx.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NetDimension.Web;
using NetDimension.Weibo;
using System.Configuration;
using System.Text;
public partial class Login : System.Web.UI.Page
{
Cookie cookie = new Cookie("WeiboDemo", 24, TimeUnit.Hour);
Client Sina = null;
OAuth oauth = new OAuth(ConfigurationManager.AppSettings["AppKey"], ConfigurationManager.AppSettings["AppSecret"], ConfigurationManager.AppSettings["CallbackUrl"]);
protected void Page_Load(object sender, EventArgs e)
{
Sina = new Client(oauth); //用cookie里的accesstoken来实例化OAuth,这样OAuth就有操作权限了
if (!IsPostBack)
{
if (!string.IsNullOrEmpty(Request.QueryString["code"]))
{
AccessToken token = oauth.GetAccessTokenByAuthorizationCode(Request.QueryString["code"]);
string accessToken = token.Token;
cookie["AccessToken"] = accessToken;
Response.Redirect("Default.aspx");
}
else
{
string url = oauth.GetAuthorizeURL(ResponseType.Code, null, DisplayType.Default);
authUrl.NavigateUrl = url;
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。