public IActionResult Serial() { var data = HardwareInfoMiddleware.CheckRegitry(); ViewBag.message = data; return(View()); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } var supportedCultures = new string[] { "en-US" }; app.UseRequestLocalization(options => options .AddSupportedCultures(supportedCultures) .AddSupportedUICultures(supportedCultures) .SetDefaultCulture("en-US") .RequestCultureProviders.Insert(0, new CustomRequestCultureProvider(context => { return(Task.FromResult(new ProviderCultureResult("en-US"))); })) ); // Middleware that run after routing occurs. Usually the following appear here: //app.UseCors(MyAllowSpecificOrigins); app.UseStaticFiles(); app.UseFileServer(new FileServerOptions { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "Images")), RequestPath = "/Images", EnableDirectoryBrowsing = true }); app.UseFileServer(new FileServerOptions { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "File")), RequestPath = "/Files", EnableDirectoryBrowsing = true }); var reportDirectory = Path.Combine(env.ContentRootPath, "Reports"); DevExpress.XtraReports.Web.Extensions.ReportStorageWebExtension.RegisterExtensionGlobal(new ReportStorageWebExtension1(reportDirectory)); DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.DataBindingMode = DevExpress.XtraReports.UI.DataBindingMode.Expressions; app.UseDevExpressControls(); // Runs matching. An endpoint is selected and set on the HttpContext if a match is found. app.UseRouting(); app.UseHttpsRedirection(); app.UseCookiePolicy(); app.UseSession(); // Enable middleware to serve generated Swagger as a JSON endpoint. app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); }); if (HardwareInfoMiddleware.CheckRegitry() != "true") { app.UseMiddleware <SerialMiddleware>(); } app.UseMiddleware <SetHeaderMidleware>(); //Add JWToken to all incoming HTTP Request Header app.Use(async(context, next) => { var JWToken = context.Session.GetString("JWToken"); if (!string.IsNullOrEmpty(JWToken)) { context.Request.Headers.Add("Authorization", "Bearer " + JWToken); } await next(); }); //Add JWToken Authentication service app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapRazorPages(); //endpoints.MapControllers(); endpoints.MapControllerRoute( name: "default", pattern: "{controller=Accounts}/{action=Login}/{id?}"); endpoints.MapHub <ChatHub>("/chatHub"); }); }