# ASP.NET Core

**Structr.AspNetCore** package contains number of classes (including tag-helpers) and extension methods to supply wide range of developer basic needs in different situations of web-development.

Big part of package consists of extensions for controllers, HttpContext, etc., allowing to avoid redundant code in widespread cases.

## Installation

AspNetCore package is available on [NuGet](https://www.nuget.org/packages/Structr.AspNetCore/).

```
dotnet add package Structr.AspNetCore
```

## Setup

There are different ways to configure Structr.AspNetCore services and most common of them is adding:

```csharp
services.AddAspNetCore();
```

This will add all tools described in [contents](#contents) section below. But if you need only some of tools then these extension methods for IServiceCollection could be used:

| Method name              | Return type          | Description                                                                                                                                                             |
| ------------------------ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AddClientAlerts          | `IServiceCollection` | Add services assisting in transferring alerts from server side to client.                                                                                               |
| AddClientOptions         | `IServiceCollection` | Add services assisting in passing data represented by dictionary via `Microsoft.AspNetCore.Http.HttpContext.Items`                                                      |
| AddActionContextAccessor | `IServiceCollection` | Add [`IActionContextAccessor`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.infrastructure.iactioncontextaccessor?view=aspnetcore-6.0) service. |
| AddUrlHelper             | `IServiceCollection` | Add [`Microsoft.AspNetCore.Mvc.IUrlHelper`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.iurlhelper?view=aspnetcore-6.0) service.               |

## Contents

* [Client](/presentation/aspnetcore/client.md) - methods providing functionality for interacting with app's client-side;
* [Http](/presentation/aspnetcore/http.md) - extension methods for http-related stuff such as HttpContext and HttpRequest;
* [JavaScript](/presentation/aspnetcore/javascript.md) - provides IActionResults and extension methods related to JavaScript and client-side things;
* [Json](/presentation/aspnetcore/json.md) - JSON-related controller extensions and actions results;
* [Mvc](/presentation/aspnetcore/mvc.md) - methods for working with ViewEngine and other common MVC stuff;
* [Referrer](/presentation/aspnetcore/referrer.md) - provides tools for working with HTTP referer and other related things;
* [Rewrite](/presentation/aspnetcore/rewrite.md) - extensions and IRule implementations related to modifying url;
* [Routing](/presentation/aspnetcore/routing.md) - extensions and classes for working with routing;
* [TagHelpers](/presentation/aspnetcore/taghelpers.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.structr.dev/presentation/aspnetcore.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
