Discuz!NT

注册

 

QQ登录

只需一步,快速开始

返回列表 «56789101112» / 14
发新话题 回复该主题

使用Discuz!NT API+DiscuzToolkit的整合实例 [复制链接]

81#

为啥我的登录界面一提交就跳到论坛的登录页面了?×háe™„švŒnt.discuz.netº>èÈb3òW¥
TOP
82#

注册页面出现这个错误怎么回事啊×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
TOP
83#

呵呵,楼主很有心。×háe™„švŒnt.discuz.netº>èÈb3òW¥
TOP
84#

恩,要研究参考一下,以前做支付宝接口,也差不多是这么做的。×háe™„švŒnt.discuz.netº>èÈb3òW¥
脚步无法到达的地方,目光可以到达;目光无法到达的地方,梦想可以到达。
TOP
85#

try×háe™„švŒnt.discuz.netº>èÈb3òW¥
行 33:                 {×háe™„švŒnt.discuz.netº>èÈb3òW¥
行 34:                     ds.session_info = ds.GetSessionFromToken(Session["AuthToken"].ToString());×háe™„švŒnt.discuz.netº>èÈb3òW¥
行 35:                 }×háe™„švŒnt.discuz.netº>èÈb3òW¥
System.NullReferenceException: 未将对象引用设置到对象的实例。×háe™„švŒnt.discuz.netº>èÈb3òW¥
最后编辑shp_yt 最后编辑于 2010-09-28 15:41:46
TOP
86#

怎么没有数据库备份文件啊×háe™„švŒnt.discuz.netº>èÈb3òW¥
TOP
87#

你好版主

由于删广告时误删了的帖子,现在补上,入对各位网友造成不便,请谅解。并强烈鄙视乱发广告者×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
本次整合只针对NETSNS中的代码做了少许修改,完成了基本的和论坛同步注册,登×háe™„švŒnt.discuz.netº>èÈb3òW¥
doopcl 发表于 2009/4/15 10:22:00
×háe™„švŒnt.discuz.netº>èÈb3òW¥
我也是和你这样做的,但是总会出现下面的这种错误,能不能帮我解决下看是什么原因,谢谢了×háe™„švŒnt.discuz.netº>èÈb3òW¥
public static byte[] GetResponseBytes(string apiUrl, string method_name, string postData)×háe™„švŒnt.discuz.netº>èÈb3òW¥
        {×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(apiUrl);×háe™„švŒnt.discuz.netº>èÈb3òW¥
            request.Method = "POST";×háe™„švŒnt.discuz.netº>èÈb3òW¥
            request.ContentType = "application/x-www-form-urlencoded";×háe™„švŒnt.discuz.netº>èÈb3òW¥
            request.ContentLength = postData.Length;×háe™„švŒnt.discuz.netº>èÈb3òW¥
            request.Timeout = 20000;×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
            HttpWebResponse response = null;×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
            try×háe™„švŒnt.discuz.netº>èÈb3òW¥
            {×háe™„švŒnt.discuz.netº>èÈb3òW¥
                StreamWriter swRequestWriter = new StreamWriter(request.GetRequestStream());×háe™„švŒnt.discuz.netº>èÈb3òW¥
                swRequestWriter.Write(postData);×háe™„švŒnt.discuz.netº>èÈb3òW¥
                if (swRequestWriter != null)×háe™„švŒnt.discuz.netº>èÈb3òW¥
                    swRequestWriter.Close();×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
                response = (HttpWebResponse)request.GetResponse();×háe™„švŒnt.discuz.netº>èÈb3òW¥
                using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))×háe™„švŒnt.discuz.netº>èÈb3òW¥
                {×háe™„švŒnt.discuz.netº>èÈb3òW¥
                    return Encoding.UTF8.GetBytes(reader.ReadToEnd());×háe™„švŒnt.discuz.netº>èÈb3òW¥
                }×háe™„švŒnt.discuz.netº>èÈb3òW¥
            }×háe™„švŒnt.discuz.netº>èÈb3òW¥
            finally×háe™„švŒnt.discuz.netº>èÈb3òW¥
            {×háe™„švŒnt.discuz.netº>èÈb3òW¥
                if (response != null)×háe™„švŒnt.discuz.netº>èÈb3òW¥
                    response.Close();×háe™„švŒnt.discuz.netº>èÈb3òW¥
            }×háe™„švŒnt.discuz.netº>èÈb3òW¥
        }×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
  response = (HttpWebResponse)request.GetResponse();这里报错.基础连接已经关闭: 接收时发生错误。×háe™„švŒnt.discuz.netº>èÈb3òW¥
Special
TOP
88#

看看×háe™„švŒnt.discuz.netº>èÈb3òW¥
It's okay
TOP
89#

回复 82# shp_yt 的帖子

我也是遇到你这种情况诶,就是登陆的时候点提交就跳到论坛的登陆页面了,在论坛这边接着等程序就抛出 Code: 102, Message: session_key已过期或失效,请重定向让用户重新登录并获得新的session_key×háe™„švŒnt.discuz.netº>èÈb3òW¥
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
异常详细信息: Discuz.Toolkit.DiscuzException: Code: 102, Message: session_key已过期或失效,请重定向让用户重新登录并获得新的session_key×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
源错误:×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
行 88:             {×háe™„švŒnt.discuz.netº>èÈb3òW¥
行 89:                 Error error = (Error)ErrorSerializer.Deserialize(new MemoryStream(response_bytes));×háe™„švŒnt.discuz.netº>èÈb3òW¥
行 90:                 throw new DiscuzException(error.ErrorCode, error.ErrorMsg);×háe™„švŒnt.discuz.netº>èÈb3òW¥
行 91:             }×háe™„švŒnt.discuz.netº>èÈb3òW¥
行 92:         }×háe™„švŒnt.discuz.netº>èÈb3òW¥
TOP
90#

LZ大大空的话帮我看看,我用的你这个项目诶,在网站登陆点提交的时候就跳到论坛的登陆页面去了×háe™„švŒnt.discuz.netº>èÈb3òW¥
×háe™„švŒnt.discuz.netº>èÈb3òW¥
,在这个页面继续用刚才的用户名完成登录的时候,程序就报session_key过期。我调试的时候看到在初始化ds对象的时候就报了个未将对象引用设置到对象的实例。帮我看看啊,我苦恼好就了哦×háe™„švŒnt.discuz.netº>èÈb3òW¥
TOP
发新话题 回复该主题
站长