Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The remote server returned an error: (404) Not Found.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
length: 6
stack trace: at System.Net.HttpWebRequest.GetResponse() at WebApplication1.WebForm1.RetriveContacts() in C:\Users\Agaram-Pc-5\Documents\Visual Studio 2010\WebApplication1\WebApplication1\WebForm1.aspx.cs:line 371
status: ProtocolError
Status Code: (404) NotFound
Status Description: Not Found on Accelerator
source: System
headers: 0: close
headers: 1: en
headers: 2: 1865
headers: 3: no-store
headers: 4: text/html
headers: 5: Wed, 29 Oct 2014 09:45:28 GMT
headers: 6: ATS
headers: 7: http/1.1 r02.ycpi.inc.yahoo.net (ApacheTrafficServer [c s f ])

How to solve the error in localhost.....
Posted
Comments
[no name] 29-Oct-14 6:04am    
Debugger here: WebForm1.aspx.cs:line 371
Member 10858852 29-Oct-14 6:11am    
private void RetriveContacts()
{
OAuthBase oauth = new OAuthBase();

Uri uri = new Uri("http://social.yahooapis.com/v1/user/" + OauthYahooGuid + "/contacts?format=XML");
string nonce = oauth.GenerateNonce();
string timeStamp = oauth.GenerateTimeStamp();
string normalizedUrl;
string normalizedRequestParameters;
string sig = oauth.GenerateSignature(uri, ConsumerKey, ConsumerSecret, OauthToken, OauthTokenSecret, "GET", timeStamp, nonce, OAuthBase.SignatureTypes.HMACSHA1, out normalizedUrl, out normalizedRequestParameters);

StringBuilder sbGetContacts = new StringBuilder(uri.ToString());

//Response.Write("URL: " + sbGetContacts.ToString());
//Response.End();

try
{
string returnStr = string.Empty;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sbGetContacts.ToString());
req.Method = "GET";

string authHeader = "Authorization: OAuth " +
"realm=\"yahooapis.com\"" +
",oauth_consumer_key=\"" + ConsumerKey + "\"" +
",oauth_nonce=\"" + nonce + "\"" +
",oauth_signature_method=\"HMAC-SHA1\"" +
",oauth_timestamp=\"" + timeStamp + "\"" +
",oauth_token=\"" + OauthToken + "\"" +
",oauth_version=\"1.0\"" +
",oauth_signature=\"" + HttpUtility.UrlEncode(sig) + "\"";

//Response.Write("</br>Headers: " + authHeader);

req.Headers.Add(authHeader);
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
StreamReader streamReader = new StreamReader(res.GetResponseStream());
returnStr = streamReader.ReadToEnd();
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(returnStr);
XmlNodeList elemList = xmldoc.DocumentElement.GetElementsByTagName("fields");

ArrayList emails = new ArrayList();
for (int i = 0; i < elemList.Count; i++)
{
if (elemList[i].ChildNodes[1].InnerText == "email")
emails.Add(elemList[i].ChildNodes[2].InnerText);
//Response.Write(elemList[i].ChildNodes[2].InnerText + "<br/>");
}
grvMyFriends.DataSource = emails;
grvMyFriends.DataBind();
}
#region error
catch (WebException ex)
{
//Response.Write(ex.Message);
Response.Write("<br/>" + ex.Message + "</br>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
Response.Write("<br/>length: " + ex.Source.Length.ToString());
Response.Write("<br/>stack trace: " + ex.StackTrace);
Response.Write("<br/>status: " + ex.Status.ToString());
HttpWebResponse res = (HttpWebResponse)ex.Response;
int code = Convert.ToInt32(res.StatusCode);

Response.Write("<br/>Status Code: (" + code.ToString() + ") " + res.StatusCode.ToString());
Response.Write("<br/>Status Description: " + res.StatusDescription);

if (ex.InnerException != null)
{
Response.Write("<br/>innerexception: " + ex.InnerException.Message);
}

if (ex.Source.Length > 0)
Response.Write("<br/>source: " + ex.Source.ToString());

if (res != null)
{
for (int i = 0; i < res.Headers.Count; i++)
{
Response.Write("<br/>headers: " + i.ToString() + ": " + res.Headers[i]);
}
}
}
#endregion error
}

This is the method i used...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900