示例#1
0
 private void VerfyUser()
 {
     DiscuzSession ds = new DiscuzSession(api, secret, url);
     try
     {
         ds.GetSessionFromToken(Request.QueryString["auth_token"]);
     }
     catch (DiscuzException de)
     {
         if (de.ErrorCode == 102)
         {
             Uri uri = ds.CreateToken();
             Response.Redirect(uri.ToString());
         }
         else
         {
             throw de;
         }
     }
     User user = ds.GetUserInfo(ds.GetLoggedInUser().UId);
     if (user.GroupId != 1)//不是管理员
     {
         Response.Redirect("UrlConfig.aspx");
     }
 }
示例#2
0
 //获取AuthToken
 public void GetAuthToken(string n, DiscuzSession ds)
 {
     Response.Redirect(ds.CreateToken().ToString() + "&next=" + n);
 }