For some reason, when a request is sent by an HttpListener to a non-standard address, it returns
<h1>Bad Request (Invalid Hostname)</h1>
Package example:
GET /index HTTP/1.1 Host: ::ffff:88.118.32.126:2548 Accept: */* HTTP/1.1 400 Bad Request Content-Type: text/html Server: Microsoft-HTTPAPI/1.0 Date: Wed, 02 Feb 2011 19:05:18 GMT Connection: close Content-Length: 39 <h1>Bad Request (Invalid Hostname)</h1>
How can i solve this?
Edit: This is my code
public class Server { private HttpListener Listener; private Log Log; public int Port = 1555; public Server(Log _log) { Log = _log; } public void Start() { Listener = new HttpListener(); Listener.Prefixes.Add(string.Format("http://{0}:{1}/", "88.118.32.126", Port)); Listener.Prefixes.Add( string.Format("http://{0}:{1}/", "*", Port));
Semas
source share