适用于.net的Foursquare SDK

我可以知道.NET C#是否有任何foursquare sdk。 我正在基于开发人员参考做,但我没有在请求令牌期间这样做,我继续得到错误。 我正在使用VS 2008和开发服务器。 我在这个错误之前搜索,因为url重写,但我不是在IIS中托管,我也检查了web.config,也没有运气。 请帮忙,谢谢。

这是我的错误:

不允许使用用于访问路径’/ login’的HTTP谓词POST。

这是我的实现:

HttpWebRequest request = null; HttpWebResponse response = null; StreamReader responseStream = null; ASCIIEncoding ascii = null; string key = ConfigurationManager.AppSettings["key"]; string secret = ConfigurationManager.AppSettings["secret"]; string callback = ConfigurationManager.AppSettings["callback"]; string obtainTokenUrl = ConfigurationManager.AppSettings["obtainTokenUrl"]; try { string postData = "client_id=" + key + "&response_type=code&redirect_uri=" + callback; ascii = new ASCIIEncoding(); byte[] postBytes = ascii.GetBytes(postData); try { request = WebRequest.Create(obtainTokenUrl) as HttpWebRequest; } catch (UriFormatException) { request = null; } if (request == null) { throw new ApplicationException("Invalid URL: " + obtainTokenUrl); } request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postBytes.Length; //add post data to request Stream postStream = request.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Close(); response = (HttpWebResponse)request.GetResponse(); Encoding encode = Encoding.GetEncoding("utf-8"); responseStream = new StreamReader(response.GetResponseStream(), encode); Response.Write(responseStream.ReadToEnd()); 

嗯,这可能是一个迂回的回答。 但也许你可以查看windows phone 7的开源4square应用程序:
http://4square.codeplex.com/

既然您可以查看源代码,就可以看到它们如何与4sq API接口:-)

SharpSquare – 适用于.NET的FourSquare SDK http://www.igloolab.com/sharpsquare/