Reputation: 4585
I am using HSS Interlink to upload download files in my application. The issue i am facing is that my download handler is returning HTTPStatusCodes like 500,404 etc. but the issue is when i fiddle the request it properly shows the 500 status code that i really wanted to returned, but in silverlight client when i check HttpWebResponse.Status in exception i get 404.. i further investigated this on msdn and found a really weird remarks:
The only status code values returned for the HTTP and HTTPS schemes are OK and NotFound.
http://msdn.microsoft.com/en-us/library/system.net.httpstatuscode%28v=vs.95%29.aspx
Is there anyone can shed some light on this? does it means silverlight webClient can only have OK and NotFound Status in response?
Upvotes: 4
Views: 994
Reputation: 4585
Found an answer to it.. silverlight need to register url scheme to 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 the only use of RegisterPrefix. i would like others to help me understand what are the potential usage of it..
EDIT:
silverlight offers to work in two modes with http stack. one is browserStack that is used by default. all cookies and auth header are handled by browser, but it will not send any status code in return to silverlight client.
ClientHttp stack on other hand offers you to get status codes and other exception details but it requires you to manage everything by yourself including cookies, headers etc.
Regards.
Upvotes: 4