IntraDotNet.AspNetCore.Wasm
1.0.2
dotnet add package IntraDotNet.AspNetCore.Wasm --version 1.0.2
NuGet\Install-Package IntraDotNet.AspNetCore.Wasm -Version 1.0.2
<PackageReference Include="IntraDotNet.AspNetCore.Wasm" Version="1.0.2" />
<PackageVersion Include="IntraDotNet.AspNetCore.Wasm" Version="1.0.2" />
<PackageReference Include="IntraDotNet.AspNetCore.Wasm" />
paket add IntraDotNet.AspNetCore.Wasm --version 1.0.2
#r "nuget: IntraDotNet.AspNetCore.Wasm, 1.0.2"
#:package IntraDotNet.AspNetCore.Wasm@1.0.2
#addin nuget:?package=IntraDotNet.AspNetCore.Wasm&version=1.0.2
#tool nuget:?package=IntraDotNet.AspNetCore.Wasm&version=1.0.2
IntraDotNet.AspNetCore.Wasm
WebAssembly polyfill for enabling Windows features when targeting an intranet environment.
Features
- Browser console logging
- HTTP request handling with browser credentials
Installation
To install the package using the dotnet
CLI, run the following command:
dotnet add package IntraDotNet.AspNetCore.Wasm
Usage
Browser Console Logging
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();
Configuration
You can configure the logging level in your appsettings.json file:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "None",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
HTTP Request Handling with Browser Credentials
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();
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.AspNetCore.Components.WebAssembly (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.