Skip to content

Unsuccessful request from C# #1579

@fhosen

Description

@fhosen

Hi there!

I have the following code in c#:

    static void Main(string[] args)
    {
        string url = "http://router.project-osrm.org/table?loc=-34.5888904,-58.4154122&loc=-34.5837883,-58.4380828&loc=-34.5936356,-58.4359398&loc=-34.6059303,-58.4306526&loc=-34.5732875,-58.4301497";
        // Create a request for the URL. 
        WebRequest request = WebRequest.Create(url);
        request.Method = "GET";           
        // Get the response
        WebResponse response = request.GetResponse ();
        // Get the stream containing content returned by the server.
        Stream dataStream = response.GetResponseStream ();
        Console.WriteLine(((HttpWebResponse)response).StatusDescription);
        // Open the stream using a StreamReader for easy access.
        StreamReader reader = new StreamReader(dataStream);
        // Read the content.
        string responseFromServer = reader.ReadToEnd();
        // Display the content.
        Console.WriteLine(responseFromServer);
        // Clean up the streams and the response.
        reader.Close();
        response.Close();
        Console.ReadLine();
    }

And when I run it I get this:
request_foridden

The thing is, when I do the same request from the browser it works just fine.

Probably, the header is not the way it is suppoused to be, I would like to know if you could help me with this.

Thanks in advanced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions