Currently the Code i am using to update twitter status is as follows...
public static void SendMessage(string message)
{
try
{
tokens = new OAuthTokens();
tokens.AccessToken = "Some Token";
tokens.AccessTokenSecret = "Some Secret";
tokens.ConsumerKey = "Some Key";
tokens.ConsumerSecret = "Some CSecret";
TwitterResponse<TwitterStatus> tweetResponse = TwitterStatus.Update(tokens, message);
}
Please spoon feed me on how to authenticate myself for a proxy on 10.0.0.21 and port 3128 requesting for a username and password.
I am able to access the net and download webpages from C# application using the following code but am not able to update twitter from twitterizer due to this issue...
WebClient w = new WebClient();
WebProxy p = new WebProxy("10.0.0.21", 3128);
p.Credentials = new NetworkCredential("UserName", "Password");
w.Proxy = p;
string s = w.DownloadString(SomeUrl);
How to do the same in twitterizer2 package...? Its not taking from IE because Authentication is required for this proxy.
I am not sure of how to modify the configuration file. One more issue is i will not run this application always behind a proxy..mostly it will be run outside a proxy.
Please help. Thanks.
Twitterizer handles proxy settings in 3 ways. They are, in order that Twitterizer chooses which to use:
<defaultproxy>
element. Good for whole applications, but unfortunately won't handle the use of authentication.Since your proxy requires authentication, the only option is to specify the optional properties class to every method.
For example:
public static void SendMessage(string message)
{
try
{
tokens = new OAuthTokens();
tokens.AccessToken = "Some Token";
tokens.AccessTokenSecret = "Some Secret";
tokens.ConsumerKey = "Some Key";
tokens.ConsumerSecret = "Some CSecret";
WebProxy p = new WebProxy("10.0.0.21", 3128);
p.Credentials = new NetworkCredential("UserName", "Password");
StatusUpdateOptions options = new StatusUpdateOptions();
options.Proxy = p;
TwitterResponse<TwitterStatus> tweetResponse = TwitterStatus.Update(tokens, message, options);
}
}