I'm trying to contact an HTTP endpoint used to remotely control a smart strip. Everything done locally in my LAN, and i figured out using an HTTP proxy, that calls are done directly to the strip if the client device is connected to the same WLAN network.
I tried to call the endpoint using Postman and did work like a charm. It just took me to copy the proxy-intercepted body and make a POST.
Now I'm trying to make the same call from some C# code, and I'm getting the exception shown in the question title.
I found another post here on SO that shows a way to solve this by changing something server-side, which is not an option in my case. Any ideas on how can I solve this?
I already tried to include all the headers Postman generates automatically, but nothing did help.
Also using different libraries to achieve http communication (RestSharp, native WebRequest) i obtain always the same result.
Related
I am using C# with Visual Studio. I have imported a WSDL file into my project, so that VS automatically created a class for me to use the appropriate services.
Now I got an error from the server and for debugging purposes I would like to see the RAW response of the server. It looks that this is quite complicated to obtain.
Please take a look at the screenshot below:
I've got only the "base.channel" object. But also after a long time of digging into all the attributes and sub-objects, I'm still not able to find the actual servers response.
The code on line 6776 is the first and only one where I can stop. So there is no possibility to look into some objects earlier.
I'm quite new to Server Client based applications with C# and WSDL. I really hope, that the mechanism, how the requests work, are always the same, so that someone could give me a hint how I can retrieve the servers raw response.
Since it is HTTPS, wireshark is no option.
Thanks
Found the solution:
I used Fiddler which is able to decrypt also SSL traffic!
I'm making a C# Wrapper for Yahoo IM API. Sometimes when I'm using the server developer.messenger.yahoo.com, it gave me errors (4xx or 5xx).
After hours searching on the web, I found this link https://help.yahoo.com/kb/SLN1227.html. The link contains information about Yahoo Messenger Servers, Port and Protocols.
I want to know can I use these servers to replace developer.messenger.yahooapis.com server?
In the link you've posted, the configurations are supposed to be used by the IM client itself, not to use with the API.
So, probably they'll NOT work.
In this link appear a different server: developer.messenger.yahooapis.com
Be aware that 4xx errors means that the request was malformed (problem in your side, be sure your code it´s correct) while 5xx errors means that there is a internal error in the server.
I've some strange problems with a web service. One problem is that I don't fully understand how SOAP works.
It seems that it is possible that two different application can connect to e.g. 127.0.0.1:8000 at least that seems possible with the code that is generated with the .NET WSDL tool. But IMO only one application is allowed to bind to a port and listen to HTTP responses. Do the .NET classes do something silently?
For a tiny test I tried to do everything on my own with the HttpWebRequest class to see where the problem is. I get some 500 StatusMessages from the Webserver that the EndpointDistpacher is unable to find an AddressFilter (I think it's probably an .NET exception for the server transfered over HTTP). I copied the SOAP request from another client that works. What I here do not understand. Does the server probably open another new connection to the client, instead of answer to the already open connection?
I don't seek direct answers for my problems. What I really wonder how TCP/HTTP is used in the background for raw SOAP and for WS-Adressing. And what I've to do, to create a simple stupid client, assuming that I only have a TCP/HTTP class.
I'm working on a project that has a C# app (running 24/7 as a server) on the client's machine). This app needs to send a file as a byte stream via POST to a server I am currently hosting on my home desktop.
Can this file be received by a C# app running on my server, or does it have to be as ASP app/page?
Also, I know how to send a bytestream via POST, but how will I set my server side app to listen for this incoming data?
I have never done something like this, so I'm looking for some pointers to get me started.
Thanks
Depending on what you need to do with the file, and when it's uploaded, there is nothing wrong with using a tiny asp.net app to do this.
If the only way you can get the file to the server is via http POST, why write your own service/daemon to run a listener? Unless you have some reason not to run it in IIS, I would do it there. There is the full stack available that way for authentication and so on if you should happen to need it. Besides, if you have to upload files via http post, I would bet you will end up wanting other methods available via HTTP as well..
You're looking for this guy:
http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx
Using that, you'll create basically a mini HTTP server, listening on some port you specify. You'll then be able to post data to it, and process it accordingly (similar to if the processing code was in an ASPX code-behind).
Assuming your open to sending directly via TCP you can look at this example if you dont wanna go the HTTP way. I personaly like the NetworkStream Class, for sending data over the network painfree.
Presently I am doing a project on designing and implementing a firewall. Everything is working fine. Here I am filtering all packets going through a TCP port. But I need to send a custom page if a page is being blocked. Like "Your page is blocked by admin". I don't have any idea how to do it. Can I do it using raw sockets? If so please tell me, how to? But as I know raw socket does not work for sending on Windows XP SP2 and later, is there any other solution?
EDIT: I used C++ to create a DLL for an IP address filter. Then I imported it in my C++ program. IP addresses are blocking fine. But my customer needs the custom message when a browser is not finding its page.
If you're selectively allowing access to certain web pages, you're essentially acting like a proxy. And you'll need to act more like one if you want to respond to clients with an error page.
A browser making an HTTP request will expect the response on the same connection it opened. In order to return a "blocked" page, you'll need to determine whether the connection is to someplace you don't want the user to go, and if not, return a valid HTTP response (even if that response is an HTTP error like "403 Forbidden" or something more appropriate to a proxy) on that same connection.
If you're blocking the connection before it's even opened, ie: blocking access to certain IP addresses, then you're kind of stuck. The most you could do is return an ICMP message saying the host isn't available. You need to at least accept the connection if you can, accept the incoming request, and reply with your error message. Anything less, and a browser typically won't know what to do with it.
Hey, Since you're working on that low level
Can't you redirect the request by modifying its HTTP header?