Friday 15 April 2011

C# System.Net.WebException Retrieving custom 404 message -


,

I am working for a client that works with a standard status code (404, 200 etc.) -with custom json also gives message

I can not find a property of webexception that includes a custom message.

Any ideas on how to catch a message?

The real webRPS is available in the Response Property in Web Expression. Here's a matter of handling responses normally:

  Private static JsonParseException ProcessException (WebException webEx) {var stream = webEx.Response.GetResponseStream (); (Var memory = new memorystream ()) using {var buffer = new byte [4096]; Var read = 0; Do {read = stream. Read (buffer, 0, buffer lang); Memory. Write (buffer, 0, reading); } While (read> gt; 0); Memory. Composition = 0; Int pagesize = (int) memory Long; Byte [] bytes = new byte [page size]; Memory. Read (byte, 0, page size); Memory. Search (0, SeekOrigin.Begin); String data = new streamrider (memory) .ddtd (); Memory.Close (); Default Meta Meta = Jason Convert. Directoryal Object & lt; Default M & gt; (Data); New JsonParseException Return (Meta Meta, Meta Meta Error, WebX); }}  

I am using the NewtonSoft Jason Library to resolve Jason's response


No comments:

Post a Comment