POST request returns 405 error

Hello,

I'm working in .Net and am trying to submit a POST httpwebrequest to the validator using the following:

Dim Url As String = "http://jigsaw.w3.org/css-validator/"
Dim Post As String = "validator?text=" & HttpUtility.UrlEncodeCSSText) & "&warning=0&profile=css2&output=soap12"

And

Private Function GetValidationResponse(ByVal Url As String, ByVal Post As String) As Stream
        Dim Writer As StreamWriter = Nothing
        Dim Request As HttpWebRequest = DirectCast(WebRequest.Create(Url), HttpWebRequest)

        Request.Method = "POST"
        Request.ContentLength = Post.Length
        Request.ContentType = "application/x-www-form-urlencoded"
        Request.Timeout = 2000

        Writer = New StreamWriter(Request.GetRequestStream())

        Using Writer
            Writer.Write(Post)
        End Using

        Writer.Close()

        Return Request.GetResponse.GetResponseStream()
    End Function

At the point of GetResponse the server returns a 405 method not allowed error, am I doing something wrong? Or does the validator not accept POST requests in this way?

Thanks.

Matt Bates
Innovasys
http://www.innovasys.com/

Received on Tuesday, 16 June 2009 20:51:53 UTC