CSDN专家博客精华版

为人民服务!
  首页  :: 新随笔  :: 管理

新CSDN 登录开放性Web Service 编程接口草案

Posted on 2007-12-17 11:20  csdnexpert  阅读(152)  评论(0)    收藏  举报

新CSDN 登录开放性Web Service 编程接口草案

这个草稿是登录WEB Service公开前,最后一次征求意见的草案。如果有任何意见和问题,请尽快联系我: ghj1976@csdn.net

登录的 Web Service 编程接口由以下两个 方法 组成。

[WebMethod(EnableSession = true)]
public byte[] UserPreLogin(string RobotName, out string ClientKey)
{
........
}


[WebMethod(EnableSession = true)]
public bool UserLogin(string LoginName, string Password, string VerifyCode, string ClientKey, out string

ErrorInfo, out string WarningInfo, out System.Net.CookieCollection Cookie)
{
.............
}

UserPreLogin 方法
传入参数
string RobotName : 客户端机器人的描述性字符串.
返回参数
string ClientKey :本次客户端请求的一个识别码,这个识别码,在登录中需要同步传入。
byte[]           :验证码图片文件流

注意: 由于登录会涉及到用户帐号和密码,我们这两个 API 只会开放给受信任的客户端。
安全起见,只有 限定的 RobotName 才可以正常使用本API。
建议用户不要使用不开源的工具,避免有盗取用户帐号和密码的可能。

UserLogin 方法
传入参数:
string LoginName  : 登录帐号名
string Password   : 登录密码
string VerifyCode : 验证码
string ClientKey  : UserPreLogin 方法返回的ClientKey值。
返回参数:
string ErrorInfo   : 如果不成功登录,返回的错误信息
string WarningInfo : 登录后的警告信息。用户仍然可以登录。但是会给一些警告信息,比如你的帐号正在频繁的登

录请求,有被暴力破解的可能,请最好及时修改密码等提示信息
System.Net.CookieCollection Cookie :以后请求CSDN登录后才能访问页面,或者Web Service的时候,需要带

的Cookie信息。
bool :  是否成功登录

返回的 CookieCollection 并不是永久有效。 CookieCollection 是有时限限制的。目前准备最长使用期间2小时。
两小时后,这个  CookieCollection 自动过期。

 



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=619794