BstHelpers.Web 10.0.13
BstHelpers.Web
Web/MVC companion to BstHelpers: extensions for HttpContext, ClaimsPrincipal, ISession, SelectList, IHtmlContent/TagBuilder, ViewContext, plus a <custom-tag> tag helper.
Tag helper
Register the tag helper assembly in _ViewImports.cshtml:
@addTagHelper *, BstHelpers.Web
Renders any HTML element from a single tag, forwarding attributes:
<custom-tag asp-tag="div" class="card"></custom-tag>
<custom-tag asp-tag="@(isLink ? "a" : "span")" href="@Model.Url" class="btn">@Model.Label</custom-tag>
Empty/whitespace attributes are skipped. If asp-tag is null, nothing is rendered.
Usage
HttpContext
var baseUrl = HttpContext.GetRequestBaseUrl(); // "https://example.com"
ClaimsPrincipal (User)
User.GetUserId(); // ClaimTypes.NameIdentifier as string
User.GetUserIdInt(); // same, parsed to int (0 if missing)
User.GetName(); // ClaimTypes.GivenName
User.IsLogged(); // authenticated AND user id != 0
User.ClaimValue("custom"); // arbitrary claim type
Session (ISession)
JSON-serialized object storage (Newtonsoft, ReferenceLoopHandling.Ignore):
HttpContext.Session.SetObject("cart", cart);
var cart = HttpContext.Session.GetObject<Cart>("cart");
SelectList
// From IEnumerable
var list = items.NewSelectList(dataValueField: "Id", dataTextField: "Name", selectedValue: 5);
// From IQueryable<T> (materializes async)
var list = await dbContext.Categories
.Select(c => new { c.Id, c.Name })
.NewSelectList("Id", "Name");
// Add a placeholder as the first option
list = list.SetPlaceholder("-- choose --");
list = list.SetPlaceholder(new HtmlString("<em>none</em>"));
HTML / TagBuilder rendering
IHtmlContent content = ...;
string html = content.ToHtmlString();
var tag = new TagBuilder("a");
tag.Attributes["href"] = "/x";
tag.InnerHtml.Append("link");
string html = tag.GetHtml();
ViewContext (in Razor views)
@using BstHelpers.Web.Extensions
@{
var action = ViewContext.GetAction();
var controller = ViewContext.GetController();
}
Showing the top 20 packages that depend on BstHelpers.Web.
| Packages | Downloads |
|---|---|
|
BstAutoLog.Web
Bomsite Auto log web extensions
|
35 |
|
BstAutoLog.Web
Bomsite Auto log web extensions
|
37 |
|
BstAutoLog.Web
Bomsite Auto log web extensions
|
39 |
|
BstAutoLog.Web
Bomsite Auto log web extensions
|
84 |
|
BstErrorService
Error Service
|
35 |
|
BstErrorService
Error Service
|
36 |
|
BstErrorService
Error Service
|
37 |
|
BstErrorService
Error Service
|
38 |
|
BstErrorService
Error Service
|
39 |
|
BstErrorService
Error Service
|
40 |
|
BstErrorService
Error Service
|
43 |
|
BstErrorService
Error Service
|
44 |
|
BstErrorService
Error Service
|
45 |
|
BstErrorService
Error Service
|
46 |
|
BstErrorService
Error Service
|
60 |
|
BstErrorService
Error Service
|
90 |
.NET 10.0
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.10)
- Newtonsoft.Json (>= 13.0.4)
| Version | Downloads | Last updated |
|---|---|---|
| 10.0.13 | 44 | 18/07/2026 |
| 10.0.12 | 89 | 14/06/2026 |
| 10.0.11 | 41 | 17/05/2026 |
| 10.0.10 | 23 | 03/05/2026 |
| 10.0.9 | 34 | 23/04/2026 |
| 10.0.8 | 21 | 16/04/2026 |
| 10.0.7 | 22 | 13/04/2026 |
| 10.0.6 | 42 | 20/03/2026 |
| 10.0.5 | 35 | 11/03/2026 |
| 10.0.4 | 32 | 10/02/2026 |
| 10.0.3 | 28 | 28/01/2026 |
| 10.0.2 | 46 | 12/12/2025 |
| 10.0.1 | 37 | 11/11/2025 |
| 9.1.5 | 32 | 20/10/2025 |
| 9.1.4 | 23 | 20/10/2025 |
| 9.1.2 | 25 | 15/10/2025 |
| 9.1.1 | 24 | 24/09/2025 |
| 9.1.0 | 42 | 06/09/2025 |
| 9.0.9 | 39 | 15/07/2025 |
| 9.0.8 | 35 | 12/06/2025 |
| 9.0.7 | 66 | 14/05/2025 |
| 9.0.6 | 43 | 22/04/2025 |
| 9.0.5 | 35 | 09/04/2025 |
| 9.0.4 | 45 | 19/03/2025 |
| 9.0.3 | 34 | 08/03/2025 |
| 9.0.2 | 38 | 07/03/2025 |
| 9.0.1 | 33 | 01/03/2025 |