public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.Run(async(context) => { var functionHandler = new FunctionHandler(); try { var response = functionHandler.Handle(context.Request); context.Response.StatusCode = response.statusCode; foreach (KeyValuePair <string, string> entry in response.headers) { HeaderDictionaryExtensions.Append(context.Response.Headers, entry.Key, entry.Value); } await context.Response.WriteAsync(response.body); } catch (Exception ex) { Console.Write(ex); context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; await context.Response.WriteAsync(ex.Message); } }); }
private bool Challenge(HttpContext context) { context.Response.StatusCode = 0x191; HeaderDictionaryExtensions.Append(context.Response.Headers, "WWW-Authenticate", "Basic realm=\"Hangfire Dashboard\""); return(false); }