简体   繁体   中英

TweetSharp exception if callback url contains IP Address

I may have stumbled onto a strange bug thats within either TweetSharp or Hammock. When trying to get an authorization token from Twitter via the normal routine of:

TwitterService service = new TwitterService(API_KEY,API_SECRET);
OAuthRequestToken request = service.GetRequestToken(GetCallBackUrl());

I've noticed that if the callback url contains an IP address instead of a machine name (localhost/SERVER1 etc), the page takes forever to load then an ArgumentNullException is thrown.

System.ArgumentNullException: Value cannot be null. 
Parameter name: query at System.Compat.Web.HttpUtility.ParseQueryString(String query, Encoding encoding) 

in f:\src\hammock\src\net40\Hammock.ClientProfile\Mono\HttpUtility.cs:line 1220 at 
System.Compat.Web.HttpUtility.ParseQueryString(String query) 
in f:\src\hammock\src\net40\Hammock.ClientProfile\Mono\HttpUtility.cs:line 1214 
at TweetSharp.TwitterService.GetRequestToken(String callback) 
in f:\src\tweetsharp\src\TweetSharp\TwitterService.OAuth.cs:line 173 
at TwitterForm.SetAuthUrl() 
at TwitterForm.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) 
at System.Web.UI.Control.LoadRecursive() 
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Once I switch back to the PC name, all seems fine, sometimes. On most clients, switching to the Name works, on some however, it doesnt and keeps throwing the above error. I suspect the people for whom changing to the PC name doesn't work, may be the fact that they're using a proxy server. I'll keep troubleshooting.

For now I just wanted to know if anyone has a possible work-around or solution to this?

In the end this bug turned out not to be caused by the IP Address but because of issues related to proxy server authentication. The account we were using to access the proxy server had a password that kept expiring, switching to an account with a fixed password resolved it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM