I am implementing Yahoo OAuth 2.0 in C# and ASP.NET, what i have noticed that HttpUtility.UrlEncode(string) fails for the encoding of returnUrl. This is the case when the returnUrl has space in it. My code is -
string consumerKey = "xxxxxxx";
string returnUrl = "http://www.example.com/TutorialCode/Yahoo OAuth 2.0/yahoooauth2.aspx";
/*Sending User To Authorize Access Page*/
string url = "https://api.login.yahoo.com/oauth2/request_auth?client_id=" + consumerKey + "&redirect_uri=" + HttpUtility.UrlEncode(returnUrl) + "&response_type=code&language=en-us";
Response.Redirect(url);
however if i change the returnUrl to-
string returnUrl = "http://www.example.com/TutorialCode/YahooOAuth2.0/yahoooauth2.aspx";
then it works. Why it is a problem in URL Encoding ? can somebody shed some light in this.
Regards