473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

send data on remote server

Hello All,

i am open this URL(
http://id.skootit.com/WorkspaceServi...d.skootit.com/) directly in browser with enter credential then its open and show xml data. but if i used this url in code means i send Requset and post data on server then i am getting Error(The remote server returned an error: (401) Unauthorized.) here i used same credentials.

I send request by this code.
Expand|Select|Wrap|Line Numbers
  1. HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create("http://id.skootit.com/WorkspaceService/ListInvitations");
  2. myHttpWebRequest.Method = "POST";
  3. string postData = "?actor=http://goku.id.skootit.com/";
  4. byte[] byte1 = Encoding.UTF8.GetBytes(postData); 
  5. myHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
  6. myHttpWebRequest.ContentLength = byte1.Length;
  7. myHttpWebRequest.Credentials = new NetworkCredential("http://goku.id.skootit.com/", "topia1", "id.skootit");
  8. Stream newStream = myHttpWebRequest.GetRequestStream();
  9. newStream.Write(byte1, 0, byte1.Length);
  10. newStream.Close();
  11.  
  12.  
  13.  
  14. //(on this line i m getting error.)
  15. WebResponse response = myHttpWebRequest.GetResponse();
  16.  
  17.  
  18. newStream = response.GetResponseStream();
  19. StreamReader reader = new StreamReader(newStream);
  20. string responseFromServer = reader.ReadToEnd();
  21. Console.WriteLine(responseFromServer);
  22. reader.Close();
  23.  newStream.Close();
  24.  response.Close();
  25.  
when execute this code then i got error (The remote server returned an error: (401) Unauthorized.)

System.Net.WebException was unhandled
Message="The remote server returned an error: (401) Unauthorized."
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at ConsoleApplication2.Program.Main(String[] args) in C:\Documents and Settings\nidhi\My Documents\Visual Studio 2008\Projects\ConsoleApplication2\ConsoleApplicati on2\Program.cs:line 71
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:


please help me how to solve this error??
Dec 20 '08 #1
0 3504

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Etienne Charland | last post by:
Hi, there is an application running on a remote desktop (under Citrix ICA, but the same problem applies for RDC or PC Anywhere). Now, I want to send keys to the remote application from a local app....
13
by: Manfred Braun | last post by:
Hi All, I am trying to understand the blocking method socket.Send(). The call blocks as expected, but does this mean, it returnes after the underlying TCP layer got a confirmation, that the send...
2
by: yvan | last post by:
Hi, Here is my client/server scenario: Step1: Client connects to server and sends data sucessfully (using Socket.Send()). Step2: Server gracefully exists (calls Socket.Shutdown() and...
1
by: danfolkes | last post by:
Hey Everyone, I am trying to send repeated messages from a "Node" to a "Server". It works the first time I send the from the Node to Server, but after that it either errors, or does not do...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.