private static void ctx_MixedAuthRequest(object sender, WebRequestEventArgs e) { try { e.WebRequestExecutor.RequestHeaders.Add( "X-FORMS_BASED_AUTH_ACCEPTED", "f"); } catch (Exception ex) { } }
public static void DisposeOfChildContainer(WebRequestEventArgs args) { var childContainer = args.HttpContext.Items[HttpContextKey] as IDependencyScope; var resolver = childContainer as BoCDependencyResolver; if (resolver != null) { resolver.Dispose(true); } if (childContainer != null) childContainer.Dispose(); }
protected override void OnExecutingWebRequest(WebRequestEventArgs args) { Logger.Information( "{Method:l} {Uri:l}\n{Body:l}", args.WebRequest.Method, args.WebRequest.RequestUri, _pendingRequestBody ); _pendingRequestBody = null; base.OnExecutingWebRequest(args); }
/// <summary> /// This is the piece of code where a typical end user developer will call the Helper dll to take care of the authentication /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ctx_ExecutingWebRequest(object sender, WebRequestEventArgs e) { try { e.WebRequestExecutor.WebRequest.CookieContainer = Helper.AttachCookie( txtWctx.Text, txtWtrealm.Text, txtWreply.Text, txtStsUrl.Text, txtUserId.Text, txtPassword.Text); } catch (Exception ex) { Helper.InValidateCookie(); new frmDialog(ex.ToString(), "Error Setting Auth Cookie").ShowDialog(); } }
private async Task<PageLinkDto> BatchWebRequest_OnWebRequest(object sender, WebRequestEventArgs<UnprocessedLink> e) { var response = new PageLinkDto { PageUrl = e.Request.PageUrl, Link = e.Request.Link }; var url = e.Request.Link.AbsoluteUri; this.processedLinks.Add(response.Link); try { using (var httpResponse = await e.Client.SendAsync(new HttpRequestMessage(HttpMethod.Head, url))) { response.StatusCode = (int)httpResponse.StatusCode; response.StatusMessage = httpResponse.ReasonPhrase; response.ContentType = httpResponse.Content.Headers.ContentType.MediaType; if (httpResponse.IsSuccessStatusCode && response.ContentType == "text/html" && e.Request.Link.Host == this.baseUri.Host) { var pageContent = await e.Client.GetStringAsync(url); var pageLinks = this.GetPageLinksFromHtml(pageContent).Distinct().ToList(); this.ProcessLinks(pageLinks, e.Request.Link); } } } catch (Exception ex) { response.StatusCode = 500; response.StatusMessage = ex.Message; } return response; }
private void Cc_ExecutingWebRequest(object sender, WebRequestEventArgs e) { // grab the OAuth access token as we need this token in our REST calls this.accessToken = e.WebRequestExecutor.RequestHeaders.Get("Authorization").Replace("Bearer ", ""); }
// Method used to add cookies to CSOM public void clientContext_ExecutingWebRequest(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.CookieContainer = getCookieContainer(); //e.WebRequestExecutor.WebRequest.UserAgent = userAgent; }
private void OnSendingRequest(object sender, WebRequestEventArgs e) { HttpUtility.SetUserAgent( e.Request, _activeProject == null ? _dialogForSolutionUserAgent.Value : _dialogUserAgent.Value, _projectGuids); }
private static void BeginRequest(object sender, WebRequestEventArgs e) { GlimpseTimer.Start("Query - " + e.Request.RequestUri.PathAndQuery, GlimpseTimerCategory); //GlimpseTimer.Moment(); }
void repository_sendingRequest(object sender, WebRequestEventArgs e) { this.addLog("Registro sending request " + e.Request.ToString()); }
private static void Context_ExecutingWebRequest(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.CookieContainer = helper.CookieContainer; }
// Method used to add cookies to CSOM public void clientContext_ExecutingWebRequest(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.CookieContainer = getCookieContainer(); }
static void Ctx_ExecutingWebRequest(object sender, WebRequestEventArgs e) { var token = @"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjVPZjlQNUY5Z0NDd0NtRjJCT0hIeEREUS1EayIsImtpZCI6IjVPZjlQNUY5Z0NDd0NtRjJCT0hIeEREUS1EayJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvaXN2ZGV2Y2hhdC1hZG1pbi5zaGFyZXBvaW50LmNvbUA4YTQwMGQwMi0zMjYzLTRkMDctOTEwMS0zOGM2ODcyY2ZlZWYiLCJpc3MiOiIwMDAwMDAwMS0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDBAOGE0MDBkMDItMzI2My00ZDA3LTkxMDEtMzhjNjg3MmNmZWVmIiwiaWF0IjoxNjA4NzkzMTA0LCJuYmYiOjE2MDg3OTMxMDQsImV4cCI6MTYwODg3OTgwNCwiaWRlbnRpdHlwcm92aWRlciI6IjAwMDAwMDAxLTAwMDAtMDAwMC1jMDAwLTAwMDAwMDAwMDAwMEA4YTQwMGQwMi0zMjYzLTRkMDctOTEwMS0zOGM2ODcyY2ZlZWYiLCJuYW1laWQiOiJiMjE3OWEyMC1hMTUzLTRjMzEtYTFlZS1lZjkxN2JiNDVhZmJAOGE0MDBkMDItMzI2My00ZDA3LTkxMDEtMzhjNjg3MmNmZWVmIiwib2lkIjoiZTE2NGQzZDItZWI4OC00NWI5LWJmMTEtNjcxOTE4OTc0MGZlIiwic3ViIjoiZTE2NGQzZDItZWI4OC00NWI5LWJmMTEtNjcxOTE4OTc0MGZlIiwidHJ1c3RlZGZvcmRlbGVnYXRpb24iOiJmYWxzZSJ9.O0rUWbCzbtyW0j560fa2yXNWoEZLSca6O7gplhVc_-Y0p3pjm8yRMCTvIfJvpFlTU5p20yvVxWHIBDCAuNABYYYFn_xQjHbOV-ZGousMaefdsC22mYCfWJDNbBvlIC24aAoLCb1cNNj6dUSVfxQ5DfhkHW-NuapMoWSX_Tm3VJvna5AmyEdeOe5DRE2hpJ4niALoTNlWYfasEda1utc9Tpzzslv0WdgUsiYrCYwe0274pV0Pn43T4csrHqOYfiweTt3-VO7ZQBvAV8001WcjodxE5tDKY3G3R6A02FD0WIO7GciiVhzE75Is0uHlajHqhv5Y4HhqWg_Y0xjv6mvk6A"; e.WebRequestExecutor.RequestHeaders["Authorization"] = "Bearer " + token; }
private void ctlLineChart1_WebRequest(object sender, WebRequestEventArgs e) { ctrlLineChartCutomerByMonth.ChartTitle = Shared.ResourceFiles.General.CustomersByMonth; ctrlLineChartCutomerByMonth.PointOptionFormatOptionFormat = PointOptionFormat.PointCount; using (IDataContextAsync context = new mBaseMyBusinessContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <T_Customers> customersRepository = new Repository <T_Customers>(context, unitOfWork); var month = new[] { Shared.ResourceFiles.General.January, Shared.ResourceFiles.General.February, Shared.ResourceFiles.General.March, Shared.ResourceFiles.General.April, Shared.ResourceFiles.General.May, Shared.ResourceFiles.General.June, Shared.ResourceFiles.General.July, Shared.ResourceFiles.General.August, Shared.ResourceFiles.General.September, Shared.ResourceFiles.General.October, Shared.ResourceFiles.General.November, Shared.ResourceFiles.General.December }; ctrlLineChartCutomerByMonth.Categories.AddRange(month); var currentUserId = AppSettings.GetActiveUserId(); var count = (from p in customersRepository.Queryable() where p.UserId == currentUserId select p).Count(); var results = customersRepository.Queryable() .Where(u => u.UserId == currentUserId) .GroupBy(o => new { Month = o.CreatedDate.Month, Year = o.CreatedDate.Year }) .Select(g => new { Month = g.Key.Month, Year = g.Key.Year, Percent = (g.Count() * 100.0) / count, }).OrderBy(a => a.Year).ThenBy(a => a.Month).ToList(); IEnumerable <int> yearList = results.Select(x => x.Year).Distinct().ToList(); var objList = new List <double>(); foreach (var year in yearList) { var overLoopData = results.Where(x => x.Year == year); for (int i = 1; i <= 12; i++) { if (year == overLoopData.Select(x => x.Year).FirstOrDefault() && overLoopData.Select(x => x.Month).FirstOrDefault() == i) { objList.Add(Math.Round(overLoopData.Select(x => x.Percent).FirstOrDefault(), 2)); } else { objList.Add(0); } if (i == 12) { ctrlLineChartCutomerByMonth.Series.Add(new SeriesItem { Data = objList, Name = year.ToString() }); objList = new List <double>(); yearList = yearList.Except(new[] { year }); } } } e.Response.ContentType = Json; var json = JsonConvert.SerializeObject(ctrlLineChartCutomerByMonth.Data, _serializerSettings); e.Response.Write(json); } }
void ctx_ExecutingWebRequest(object sender, WebRequestEventArgs e) { try { e.WebRequestExecutor.WebRequest.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f"); } catch { throw; } }
private static void BeginRequest(object sender, WebRequestEventArgs e) { NewRelic.Api.Agent.NewRelic.IncrementCounter("RavenDB/RequestCount"); }
protected override void OnExecutingWebRequest(WebRequestEventArgs args) { base.OnExecutingWebRequest(args); }
private void OnSendingRequest(object sender, WebRequestEventArgs e) { SendingRequest(this, e); }
static void context_ExecutingWebRequest(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.Headers["Authorization"] = string.Format("Bearer {0}", ac); }
/// <summary> /// Disable FORMS authentication to work-around auth error when activated. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void ExecutingWebRequestHandler(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f"); }
public virtual void ConfigureRequest(object sender, WebRequestEventArgs e) { SetAuthorization(e); }
private static void ctx_ExecutingWebRequest(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"; e.WebRequestExecutor.WebRequest.CookieContainer = msOnlineHelper.CookieContainer; }
private static void ExecutingWebRequestHandler(object sender, WebRequestEventArgs e) { RequestHeaders = e.WebRequestExecutor.RequestHeaders; (sender as ClientContext).ExecutingWebRequest -= ExecutingWebRequestHandlerInstance; }
void SendingRequest(object sender, WebRequestEventArgs e) { HttpUtility.SetUserAgent(e.Request, userAgent.ToString()); }
private void widgetTagCloud_WebRequest(object sender, WebRequestEventArgs e) { e.Response.ContentType = "application/json"; e.Response.Write(getData()); }
private void ctx_ExecutingWebRequest(object sender, WebRequestEventArgs e) { accessToken = e.WebRequestExecutor.RequestHeaders.Get("Authorization"); }
internal void FireExecutingWebRequestEventInternal(WebRequestEventArgs args) { this.OnExecutingWebRequest(args); }
protected virtual void OnSendingRequest(object sender, WebRequestEventArgs e) { HttpUtility.SetUserAgent(e.Request, _psCommandsUserAgent.Value); }
/// <summary> /// Populate TagCloud from DataTable /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void widgetTagCloud_WebRequest(object sender, WebRequestEventArgs e) { e.Response.ContentType = "application /json"; e.Response.Write(DataTableToJson(dtSearchEngines)); }
private void OnSendingRequest(object sender, WebRequestEventArgs e) { HttpUtility.SetUserAgent(e.Request, _dialogUserAgent.Value); }
public static void context_ExecutingWebRequest(object sender, WebRequestEventArgs e, string token) { e.WebRequestExecutor.RequestHeaders["Authorization"] = "Bearer " + token; }
private static void ctx_ExecutingWebRequest(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.CookieContainer = helper.CookieContainer; e.WebRequestExecutor.WebRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)"; }
private void Context_ExecutingWebRequest(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.UserAgent = userAgent; }
private static void JsonRequestFactory_ConfigureRequest(object sender, WebRequestEventArgs e) { e.Request.Timeout = RavenRequestTimeoutMilliseconds; }
private static void Ctx_ExecutingWebRequest(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f"); e.WebRequestExecutor.WebRequest.ServerCertificateValidationCallback += (o, certificate, chain, errors) => true; }
/// <summary> /// provide data for PivotGrid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void widgetPivotGrid_WebRequest_1(object sender, WebRequestEventArgs e) { e.Response.ContentType = "application /json"; e.Response.Write(GenerateData()); }
private void Cc_ExecutingWebRequest(object sender, WebRequestEventArgs e) { // Capture the OAuth access token since we want to reuse that one in our REST requests _accessToken = e.WebRequestExecutor.RequestHeaders.Get("Authorization").Replace("Bearer ", ""); }
async void clientContext_NativeApplicationExecutingWebRequest(object sender, WebRequestEventArgs e) { var host = new Uri(_contextUrl); var ar = await AcquireNativeApplicationTokenAsync(_commonAuthority, host.Scheme + "://" + host.Host + "/"); if (ar != null) { e.WebRequestExecutor.RequestHeaders["Authorization"] = "Bearer " + ar.AccessToken; } }
private static void ClientContext_ExecutingWebRequestCookieCounter(object sender, WebRequestEventArgs e) { var fedAuth = false; var rtFa = false; if (e.WebRequestExecutor != null && e.WebRequestExecutor.WebRequest != null && e.WebRequestExecutor.WebRequest.CookieContainer != null) { var cookies = e.WebRequestExecutor.WebRequest.CookieContainer.GetCookies(e.WebRequestExecutor.WebRequest.RequestUri); if (cookies.Count > 0) { for (var q = 0; q < cookies.Count; q++) { if (cookies[q].Name == "FedAuth") { fedAuth = true; } if (cookies[q].Name == "rtFa") { rtFa = true; } } } } hasAuthCookies = fedAuth && rtFa; }
protected override void OnSendingRequest(object sender, WebRequestEventArgs e) { Project project = GetProject(throwIfNotExists: false); var projectGuids = project == null ? null : project.GetAllProjectTypeGuid(); HttpUtility.SetUserAgent(e.Request, DefaultUserAgent, projectGuids); }
static void clientContext_ExecutingWebRequest(object sender, WebRequestEventArgs e) { e.WebRequestExecutor.WebRequest.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f"); }
private void ctx_ExecutingWebRequest_FixForMixedMode(object sender, WebRequestEventArgs e) { // to support mixed mode auth e.WebRequestExecutor.RequestHeaders.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f"); }
void ctx_MixedAuthRequest(object sender, WebRequestEventArgs e) { try { // Add the header that tells SharePoint to use Windows authentication. e.WebRequestExecutor.RequestHeaders.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f"); } catch (Exception ex) { throw new AttributeStoreInvalidConfigurationException("Error setting authentication header" + ex, ex); } }