protected virtual void ConnectRemote() { try { string serverUri = HtmlPage.DocumentUri.ToString(); int thisApp = serverUri.IndexOf(SubSite); serverUri = serverUri.Substring(0, thisApp) + WebService; System.Uri webServiceUri = new System.Uri(serverUri + Function + Parameter + Value); _request = new BrowserHttpWebRequest(webServiceUri); IAsyncResult iar = _request.BeginGetResponse(new AsyncCallback(OnResponseDownload), _request); this.Caption = serverUri + Function + Parameter + Value; } catch (Exception ex) { _caption = ex.ToString(); } }
private void GetJSONData() { string serverUri = HtmlPage.DocumentUri.ToString(); int thisApp = serverUri.IndexOf("/silverlight/album"); serverUri = serverUri.Substring(0, thisApp) + "/services/MixObjects.asmx/AlbumData?albumid="; //"http://localhost/services/MixObjects.asmx/AlbumData?albumid="; string value = ""; HtmlPage.QueryString.TryGetValue("albumid", out value); System.Uri webServiceUri = new System.Uri(serverUri + value); BrowserHttpWebRequest request = new BrowserHttpWebRequest(webServiceUri); IAsyncResult iar = request.BeginGetResponse(new AsyncCallback(OnResponseDownload), request); }