This is a small helper package that provides a number of small helper and extension classes that facilitate common operations in ASP.NET Core and MVC applications.
For documentation on sub-components please see their respective folders:
You can install the package from NuGet in Visual Studio:
PM> install-package westwind.aspnetcore
or the dotnet
command line:
dotnet add package westwind.aspnetcore
There is also a separate package for Westwind.AspNetCore.Markdown which provides a Markdown TagHelper and Markdown Parsing services:
PM> install-package westwind.aspnetcore.markdown
or the dotnet
command line:
dotnet add package westwind.aspnetcore.markdown
-
Api Error Handling Filter
A custom API error filter implementation that returns API responses on exceptions. Also provides a standardizedApiExecption
class that can be used to force responses with specific HTTP response codes. -
RawRequest Body String Formatter
API formatter that allows for receiving raw non-json content tostring
andbyte[]
parameters, which otherwise isn't supported by MVC's API implementation. More info in blog post.
-
BaseController and BaseViewModel implementation
A common base controller class that adds support for an auto-initialized BaseViewModel from which other VMs can inherit. Allows for automatic initialization of common features like ErrorDisplay or -
AppUser ClaimsPrincipal and Cookie Authentication Helper
AAppUser
class that wraps aClaimsPrincipal
and makes it easier to add and retrieve claims as well as easily login and logout all from a single helper object. -
Bootstrap Alert ErrorDisplay Tag Helper and Controller Support Feature
In most MVC applications you need some sort of error display and this ErrorDisplay TagHelper makes it quick easy to display an Alert box from a customErrorDisplayModel
input. Helper methods likeShowError()
orShowInfo()
onBaseViewModel
make it very easy to display error and informational messages on pages.
- HttpRequest Extensions
GetBodyStringAsync()
andGetRawBodyBytesAsync()
- retrieve raw non-JSON contentMapPath()
- Map virtual path to physical path on diskParams()
- Return an item from Form, Query or Session collections.