Loading ...
Sorry, an error occurred while loading the content.

The remote server returned an error: (403) Forbidden.

Expand Messages
  • chitra.devise
    Hi, I m getting 403 forbidden error. I m having Consumer Key, Consumer Secret, Application URL, Callback Domain Here is my code for web service in VB.NET Dim
    Message 1 of 1 , Jul 10, 2014
    • 0 Attachment

      Hi, I'm getting 403 forbidden error. I'm having Consumer Key, Consumer Secret, Application URL, Callback Domain


      Here is my code for web service in VB.NET


      Dim consumerKey As String = "MY_KEY"

              Dim consumerSecret As String = "MY_SECRET"

              Dim uri = New Uri("http://yboss.yahooapis.com/ysearch/web?q=" + query + "&format=xml")

              Dim url As String, param As String

              Dim oauth = New OAuthBase()

              Dim nonce = oauth.GenerateNonce()

              Dim timeStamp = oauth.GenerateTimeStamp()


              Dim signature = oauth.GenerateSignature(uri, consumerKey, consumerSecret, String.Empty, String.Empty, "GET", timeStamp, nonce, OAuthBase.SignatureTypes.HMACSHA1, url, param)

              Dim sb As New StringBuilder

              sb.Append("https://api.login.yahoo.com/oauth/v2/get_request_token")

              sb.Append("?oauth_nonce=" + nonce)

              sb.Append("&oauth_timestamp=" + timeStamp)

              sb.Append("&oauth_consumer_key=" + consumerKey)

              sb.Append("&oauth_signature_method=HMAC-SHA1")

              sb.Append("&oauth_signature=" + signature)

              sb.Append("&oauth_version=2.0")

              sb.Append("&xoauth_lang_pref='en-us'")

              sb.Append("&oauth_callback='oob'")

              Dim resp = WebRequest.Create(String.Format("{0}?{1}&oauth_signature={2}", url, param, signature)).GetResponse()

              resp.Headers.Add(sb.ToString)


              Dim dataStream = resp.GetResponseStream

              Dim rdr = New IO.StreamReader(dataStream)

              Dim ans = rdr.ReadToEnd()

       Return ans

       

      I'm not getting where have I gone wrong ?? Please tell me what's wrong with my code and if possible give me some code sample related to this code.


      Awaiting your reply. You help will be very beneficial. I'm trying hard to find it out since 2 weeks. but not getting any solution.

    Your message has been successfully submitted and would be delivered to recipients shortly.