Integrazione .NET - Guida rapida
Lo scopo di questa guida è illustrare come eseguire un'integrazione di base di CrowdHandler .NET nella propria applicazione MVC.
For further customization and advanced configurations, please refer to the project's GitHub repository or NuGet documentation.
1.) Add reference to your project.
Il modo più semplice per farlo è utilizzare NuGet: cerca il Crowdhandler.MVCSDK pacchetto nel gestore di pacchetti NuGet oppure, in alternativa, tramite la CLI di .NET.
dotnet add package Crowdhandler.MVCSDK
2.) Apply the Crowdhandler Filter Attribute to your Controller Actions.
ExampleTicketingController.cs
using Crowdhandler.MVC5SDK;
namespace MyTicketingApp.Controllers
{
public class TicketingController : Controller
{
[CrowdhandlerFilter]
public ActionResult Index()
{
return View();
}
}
}
Imposta i modelli di URL da ignorare passando al filtro il parametro "Exclusions" con un'espressione regolare contenente i modelli che non desideri vengano presi in considerazione per l'accodamento.
Common patterns to ignore are:
- Paths used for storing static assets and media, e.g. /static-media/*
- URL di callback generati da fornitori di servizi di pagamento di terze parti.
- Feed JSON e RSS.
ExampleTicketingController.cs
using Crowdhandler.MVCSDK;
namespace MyTicketingApp.Controllers
{
public class TicketingController : Controller
{
[CrowdhandlerFilter(Exclusions = @"^(\/contact-us.*)|((?!.*\?).*(\.(avi|css|eot|gif|ICO|jpg|jpeg|js|json|mov|mp4|mpeg|mpg|og[g|v]|pdf|png|svg|ttf|txt|wmv|woff|woff2|xml)))$")]
public ActionResult Index()
{
return View();
}
}
}
3.) Inject CrowdHandler Configuration.
* Public and Private keys can be found in the Account → API section of the CrowdHandler administration control panel.
tramite app.config oppure web.config
<appSettings>
<add key="CROWDHANDLER_PUBLIC_KEY" value="YOUR_PUBLIC_KEY"/>
<add key="CROWDHANDLER_PRIVATE_KEY" value="YOUR_PRIVATE_KEY"/>
</appSettings>
In alternativa, possono essere iniettati direttamente nel filtro.
using Crowdhandler.MVC5SDK;
namespace MyTicketingApp.Controllers
{
public class TicketingController : Controller
{
[CrowdhandlerFilter(PrivateApiKey = "YOUR_PRIVATE_KEY", PublicApiKey = "YOUR_PUBLIC_KEY")]
public ActionResult Index()
{
return View();
}
}
}
* A full list of configurables and their default settings can be found in section 2b of the NuGet documentation.
https://www.nuget.org/packages/Crowdhandler.MVCSDK/
4.) Install CrowdHandler JavaScript Integration
Perché devo farlo se sto integrando CrowdHandler lato server?
To ensure that the integration executes as quickly as possible, functionality not considered mission-critical is offloaded to the client side via our JavaScript Integration.
Se questa funzionalità non è essenziale per il funzionamento del sistema, posso saltare questo passaggio?
Theoretically yes, but practically we recommend against it. Installing the JavaScript integration enables features such as page performance tracking and smart session keep alive.
Il primo è un requisito indispensabile affinché la nostra funzione di regolazione automatica funzioni correttamente, oltre a fornire informazioni sulle prestazioni della vostra applicazione sotto carico.
The latter synchronizes session information between the client side and CrowdHandler's backend, preventing recently active users that have spent longer than the configured CrowdHandler session time from being sent to CrowdHandler's session validator for revalidation needlessly.
How do I install the JavaScript integration
The JavaScript can be installed via Google Tag Manager, by directly including it in the head of your master template or in any other way that is convenient to you.
You can find instructions on installing our JavaScript integration.
5.) Change integration type to .NET in CrowdHandler control panel.
La selezione dell'implementazione può essere effettuata dalla schermata dei domini.

6.) What Now?
Once you have completed the .NET integration steps we recommend checking out our getting started guide which will help familiarize you with creating and configuring waiting rooms from within the CrowdHandler control panel.