WebAssembly polyfill for enabling Windows features when targeting an intranet environment.
$ dotnet add package IntraDotNet.AspNetCore.WasmWebAssembly polyfill for enabling Windows features when targeting an intranet environment.
To install the package using the dotnet CLI, run the following command:
dotnet add package IntraDotNet.AspNetCore.Wasm
You can add browser console logging to your ASP.NET Core application by using the AddBrowserConsole extension method.
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using IntraDotNet.AspNetCore.Wasm.BrowserConsole;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Logging.AddBrowserConsole();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.Run();
You can configure the logging level in your appsettings.json file:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "None",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
You can use the BrowserIncludeRequestCredentialsDelegatingHandler to include browser request credentials in your HTTP requests. Register the handler with dependency injection and use it in your services.
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Net.Http;
using IntraDotNet.AspNetCore.Wasm.Fetch;
var builder = WebApplication.CreateBuilder(args);
//Add AddBrowserIncludeRequestCredentials to the HttpClient builder
//See example project, Pages/Home.razor for an example of using HttpClient with this handler
builder.Services.AddHttpClient("MyClient")
.ConfigurePrimaryHttpMessageHandler<BrowserIncludeRequestCredentialsDelegatingHandler>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.Run();
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.