public void AppExceptionCall(AsyncCallback callback, AsyncCallback exceptionCallback, ExceptionRequest state) { String stringURL = this.WebServiceDomain; stringURL += "/App/Exception/?"; stringURL += "login="******"&appversion=" + HttpUtility.UrlEncode(state.AppVersion); stringURL += "&appname=" + HttpUtility.UrlEncode(state.AppName); stringURL += "&phoneid=" + HttpUtility.UrlEncode(state.PhoneId); stringURL += "&exception=" + HttpUtility.UrlEncode(state.Exception); Uri uri = new Uri(stringURL); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri); httpWebRequest.AllowAutoRedirect = false; // WWB: Setup Timer for tracking Http request time out HttpWebRequestTimer httpRequestTimer = new HttpWebRequestTimer(httpWebRequest, httpRequestTimeOut); // WWB: If The Timer Ticks, This Is The Method That Handles the Timeout httpRequestTimer.Elapsed += new ElapsedEventHandler(httpRequestTimer_Tick); // Create a Packet Of Information To Surive The Aysnc Call InternalRequestState<ExceptionRequest> requestState = new InternalRequestState<ExceptionRequest>() { ExternalRequestState = state, HttpWebRequest = httpWebRequest, Callback = callback, ExceptionCallback = exceptionCallback, HttpWebRequestTimer = httpRequestTimer }; // WWB: Start The Time Out Timer httpRequestTimer.Start(); // Make the Actual HTTP Request on A Background Worker Thread IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(new AsyncCallback(AppExceptionCallback), requestState); //IAsyncResult asyncResult = httpWebRequest.BeginGetResponse(null, requestState); }
public static void PostException(Exception ex, string extra) { // now post to Windows Azure Table Storage // phone id doesn't have Microsoft.Phone.Info.UserExtendedProperties.GetValue("ANID") // because we have logon ExceptionRequest request = new ExceptionRequest() { Login = "******", AppName = App.AppName, AppVersion = App.AppVersion, PhoneId = Phone.GetWindowsLiveAnonymousID() + "-" + Phone.GetManufacturer(), Exception = "[exception]:" + ex + " [extra]: " + extra + " [ex.Message]: " + ex.Message + " [ex.StackTrace]: " + ex.StackTrace }; // WWB: Create a client pointed at the live web service ClientException client = new ClientException(App.ViewModel.RESTServer); // WWB: Make an async request for deployment information, response data processed in Call Backs client.AppExceptionCall(null, null, request); }