Silverlight WebClient and HTTP Status Codes

I use HSS Interlink to upload download files to my application. The problem I am facing is that my download handler returns HTTPStatusCodes, e.g. 500,404 etc., but the problem is that when I engage the request, it correctly displays the 500 status code, which I really I wanted to return, but in the Silverlight client, when I check HttpWebResponse.Status in the exception, I get 404 .. I additionally examined this on msdn and found really strange notes:

The only status code values โ€‹โ€‹returned for the HTTP and HTTPS OK and NotFound schemes.

http://msdn.microsoft.com/en-us/library/system.net.httpstatuscode%28v=vs.95%29.aspx

Can anyone shed some light on this? Does this mean that silverlight webClient can only have OK and NotFound Status in response?

+4
source share
1 answer

Found an answer to it. silverlight needs to register a url scheme so that it can handle incoming httpstatus codes.

bool httpResult = WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp); bool httpsResult = WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp); 

I am sure this is not the only use of RegisterPrefix. I would like others to help me understand what their potential use is.

EDIT:

silverlight offers to work in two modes using http stack. one is the default browser. all cookies and the auth header are processed by the browser, but it does not send a status code in exchange for the Silverlight client.

The ClientHttp table, on the other hand, offers you to receive status codes and other information about the exception, but it requires that you manage everything yourself, including cookies, headers, etc.

Sincerely.

+4
source

All Articles