i'm using OAuthBase.cs from oauth.googlecode.com for generate
signature.
<blockquote><code><font size="2" face="Courier New"
color="black"><font color="#0000ff">public</font> <font
color="#0000ff">static</font> <font color="#0000ff">void</font>
Status_Update()
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OAuthBase oAuth = <font
color="#0000ff">new</font> OAuthBase();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> consumerKey = <font color="#A31515">"My consumer key "</font>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> consumerSecret = <font color="#A31515">" My consumer secret "</
font>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> oauth_token = <font color="#A31515">" token "</font>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> oauth_token_secret = <font color="#A31515">" token secret "</
font>;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2B91AF">Uri</font>
uri = <font color="#0000ff">new</font> <font color="#2B91AF">Uri</
font>(<font color="#A31515">"http://api.twitter.com/1/statuses/
update.xml"</font>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> normUri;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> normParams;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> timeStamp = oAuth.GenerateTimeStamp();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> nonce = oAuth.GenerateNonce();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> oauth_signature = oAuth.GenerateSignature(uri, consumerKey,
consumerSecret, oauth_token, oauth_token_secret, <font
color="#A31515">"POST"</font>, timeStamp, nonce,
OAuth.OAuthBase.SignatureTypes.HMACSHA1, <font color="#0000ff">out</
font> normUri, <font color="#0000ff">out</font> normParams);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WebClient wcl = <font
color="#0000ff">new</font> WebClient();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wcl.Headers.Add(<font
color="#A31515">"Authorization: OAuth "</font> +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font
color="#A31515">"oauth_nonce=\""</font>+ nonce +<font
color="#A31515">"\", "</font> +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font
color="#A31515">"oauth_signature_method=\"HMAC-SHA1\", "</font> +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font
color="#A31515">"oauth_timestamp=\""</font>+timeStamp+<font
color="#A31515">"\", "</font> +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font
color="#A31515">"oauth_consumer_key=\""</font>+consumerKey+<font
color="#A31515">"\", "</font> +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font
color="#A31515">"oauth_token=\""</font>+oauth_token+<font
color="#A31515">"\", "</font> +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font
color="#A31515">"oauth_signature=\""</font>+oauth_signature+<font
color="#A31515">"\", "</font> +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font
color="#A31515">"oauth_version=\"1.0\""</font>);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wcl.<font
color="#2B91AF">Encoding</font> = System.Text.<font
color="#2B91AF">Encoding</font>.UTF8;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2B91AF">Console</
font>.WriteLine(<font color="#A31515">"Out:{0}?{1}"</font>, normUri,
normParams);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">string</
font> reply = wcl.UploadString(normUri, <font color="#A31515">"POST"</
font>, normParams);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#2B91AF">Console</
font>.WriteLine(reply);
&nbsp;&nbsp;&nbsp;&nbsp;}</font>

<font size="1" color="gray">* This source code was highlighted with <a
href="http://virtser.net/blog/post/source-code-highlighter.aspx";><font
size="1" color="gray">Source Code Highlighter</font></a>.</font></
code></blockquote>

Why don't work?

Unhandled Exception: System.Net.WebException: The remote server
returned an error: (417) Expectation Failed.

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en

Reply via email to