WebQuark is a lightweight, modular .NET utility library that streamlines web request, session handling, and routing across both legacy .NET Framework and modern .NET / ASP.NET Core environments.
WebQuark is split into small, focused projects:
This guide shows how to integrate the WebQuark library for unified abstraction across different .NET platforms, including .NET Core and legacy .NET Framework.
For .NET Core applications, WebQuark provides extension methods to register all core services using the built-in dependency injection (DI) container.
using WebQuark.Extensions;
var builder = WebApplication.CreateBuilder(args);
// Add required services
builder.Services.AddRazorPages();
builder.Services.AddSession();
builder.Services.AddHttpContextAccessor(); // Register IHttpContextAccessor
builder.Services.AddWebQuark(); // Register all WebQuark services
var app = builder.Build();
// Configure WebQuark's QueryStringHandler with IHttpContextAccessor
var accessor = app.Services.GetRequiredService<IHttpContextAccessor>();
WebQuark.QueryString.QueryStringHandler.ConfigureHttpContextAccessor(accessor);
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseSession();
app.UseRouting();
app.UseAuthorization();
app.MapStaticAssets();
app.MapRazorPages().WithStaticAssets();
app.Run();You can also register services individually if needed:
builder.Services.AddWebQuarkHttpRequestInspector();
builder.Services.AddWebQuarkHttpResponseHandler();
builder.Services.AddWebQuarkRequestQueryHandler();
builder.Services.AddWebQuarkSessionHandler();For legacy ASP.NET Framework projects (e.g., targeting .NET Framework 4.7.2), WebQuark services can be used directly by instantiating their classes:
var responseHandler = new HttpResponseHandler();
var queryHandler = new QueryStringHandler();
var sessionHandler = new SessionHandler();
var requestInspector = new HttpRequestInspector();Thank you for considering to help out with the source code! If you'd like to contribute, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base.
- Setting up Git
- Fork the repository
- Open an issue if you encounter a bug or have a suggestion for improvements/features
WebQuark source code is available under MIT License, see license in the source.
Please contact at francesco.delre[at]protonmail.com for any details.
