Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 2.78 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Jquery WCF error processing
  2. [OperationContract]
  3.   [FaultContract(typeof(MyError))]
  4.   [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
  5.     Data GetStores(int dataViewID, string filter, MapExtent extent);
  6.        
  7. $.ajax({
  8.         url: serviceurl + 'GetStore',
  9.         type: 'POST',
  10.         contentType: 'application/json',
  11.         dataType: "json",
  12.         data: ....
  13.         success: function (result) {          
  14.         },
  15.         error: function (xhr) {
  16.             ShowError(xhr);            
  17.         }
  18.     });
  19.        
  20. MyError error = new MyError() { Problem = message };
  21.             throw new FaultException<MyError>(error, new FaultReason(error.Problem));
  22.        
  23. "<?xml version="1.0" encoding="utf-8"?><HTML><HEAD><STYLE type="text/css">#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}</STYLE>
  24.  
  25. <TITLE>Request Error</TITLE></HEAD><BODY>
  26.  
  27. <DIV id="content">
  28.  
  29. <P class="heading1">Request Error</P>
  30.  
  31. <BR/>
  32.  
  33. <P class="intro">The server encountered an error processing the request. The exception message is 'You are not currently logged in or your session has expired'. See server logs for more details. The exception stack trace is:</P>
  34.  
  35. <P class="intro">  My.cs:line 1728
  36.  
  37.    at ServiceBase.CheckAuthentication() in ServiceBase.cs:line 96
  38.  
  39. .....
  40.  
  41.    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
  42.  
  43.    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</P>
  44.  
  45. </DIV>
  46.  
  47. </BODY></HTML>"
  48.        
  49. error: function(xhr, description, error)  {
  50.                     alert(description);      
  51.                     alert(error);            
  52.                 }
  53.        
  54. $.ajax({
  55.         url: serviceurl + 'GetStore',
  56.         type: 'POST',
  57.         contentType: 'application/json',
  58.         dataType: "json",
  59.         data: ....
  60.         success: function (result) {          
  61.         },
  62.         error: function(xhr, description, error)  {
  63.                 alert(description);      
  64.                 alert(error);            
  65.             }
  66.     });