المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : The remote server returned an error: (401) Unauthorized???????



C# Programming
07-21-2009, 12:13 PM
Hello frnds,

It seems common error but i can access the url using IE browser by giving specific creadentials.
e.g.
url: http:\\something.com\document\file.xml
UserName: userName
password: pwd

But when i am trying to acces that link programatically, the error comes


HttpWebRequest httpWebRequest =WebRequest.Create ("http:\\something.com\document\file.xml") as HttpWebRequest;

httpWebRequest.Credentials = new NetworkCredential(@"userName", "pwd");
httpWebRequest.Method = WebRequestMethods.Http.Get;

HttpWebResponse response = httpWebRequest.GetResponse() as HttpWebResponse;



thnks http://www.barakasoft.com/script/Forums/Images/smiley_WTF.gif