I have java service that I need to use (can't modify it) and web server that uses digest HTTP authorization. I'm using HttpWebRequest to communicate with the server (with GET method). NetworkCredentials needed for authentication are provided. But invoking GetResponse() generates error 400 (Bad request).
Address: http://info.server.com/someFolder/servlet.do?cmd=get_info&param=value
Request example (not complete, only relevant things):
GET /someFolder/servlet.do?cmd=get_info¶m=value HTTP/1.1
Host: info.server.com
Response: 401 Authorization Required
Second request:
GET /someFolder/servlet.do?cmd=get_info¶m=value HTTP/1.1
Host: info.server.com
Authorization: Digest ... uri="/someFolder/servlet.do" ... (not complete header obviously)
Second response: 400 Bad request
I've tried this request with Web browsers (IE, Firefox) and it works but it seems that browser put the whole request uri in the uri parth of Authorization header, while HttpWebRequest formats the header as above. Does anyone know how to force HttpWebRequest to put the entire uri in the Authorization header? Or maybe there is another soluation to that problem?
Thanks for the help!