Wangkanai.Responsive 2.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
.NET Standard 2.0
There is a newer version of this package available.
See the version list below for details.
dotnet add package Wangkanai.Responsive --version 2.0.0
NuGet\Install-Package Wangkanai.Responsive -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Wangkanai.Responsive" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Wangkanai.Responsive --version 2.0.0
#r "nuget: Wangkanai.Responsive, 2.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Wangkanai.Responsive as a Cake Addin
#addin nuget:?package=Wangkanai.Responsive&version=2.0.0

// Install Wangkanai.Responsive as a Cake Tool
#tool nuget:?package=Wangkanai.Responsive&version=2.0.0

ASP.NET Core Detection

GitHub Build status GitHub Open Collective Patreon

  • Wangkanai.Detection NuGet Badge NuGet Badge
  • Wangkanai.Responsive NuGet Badge NuGet Badge

Build history

ASP.NET Core client web browser detection extension to resolve devices, platforms, engine of the client.

ASP.NET Core Responsive middleware for routing base upon request client device detection to specific view

ASP.NET Core Responsive

Installation

Installation of detection library is now done with a single package reference point.

PM> install-package Wangkanai.Detection

Installation of Responsive library will bring in all dependency packages (This will include `Wangkanai.Detection.Device).

PM> install-package Wangkanai.Responsive

Configuration

This library host the component to resolve the access client device type.

Implement of the library into your web application is done by configuring the Startup.cs by adding the detection service in the ConfigureServices method.

public void ConfigureServices(IServiceCollection services)
{
	// Add detection services container and device resolver service.
    services.AddDetection();

    // Add framework services.
    services.AddMvc();
}
  • AddDetection() Adds the detection services to the services container.

If you would like to add Responsive is configured in the ConfigureServices method also:

public void ConfigureServices(IServiceCollection services)
{
    // Add responsive services.
    services.AddResponsive();

    // Add framework services.
    services.AddMvc();  
}

Or you can customize the responsive

public void ConfigureServices(IServiceCollection services)
{
    // Add responsive services.
    services.AddResponsive(options =>
    {
        options.View.DefaultTablet = DeviceType.Desktop;
        options.View.DefaultMobile = DeviceType.Desktop;
        options.View.DefaultDesktop = DeviceType.Desktop;
    });

    // Add framework services.
    services.AddMvc();  
}
  • AddResponsive() Adds the Responsive services to the services container.

    • Suffix Ex *views/[controller]/[action]/index.mobile.cshtml*
    • SubFoler Ex *views/[controller]/[action]/mobile/index.cshtml*

The current device on a request is set in the Responsive middleware. The Responsive middleware is enabled in the Configure method of Startup.cs file.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    app.UseResponsive();

    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Home}/{action=Index}/{id?}");
    });
}

Global Resolver

This library host the component to resolve all the access client related resolver that could resolve.

Example of calling the detection service in the Controller using dependency injection.

public class HomeController : Controller
{
    private readonly IDetection _detection;

    public HomeController(IDetection detection)
    {
        _detection = detection;
    }

    public IActionResult Index()
    {
        return View(_detection);
    }
}
  • IDetection is main service for you to access detection service.

When the Detection is pass to the view you can render results like the following example.

@model Wangkanai.Detection.Detection

<h3>UserAgent</h3>
<code>@Model.UserAgent</code>

<h3>Results</h3>

<table>
    <thead>
        <tr>
            <th>Resolver</th>
            <th>Type</th>
            <th>Version</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>Device</th>
            <td>@Model.Device?.Type.ToString()</td>
            <td></td>
        </tr>
        <tr>
            <th>Browser</th>
            <td>@Model.Browser?.Type.ToString()</td>
            <td>@Model.Browser?.Version</td>
        </tr>
        <tr>
            <th>Platform</th>
            <td>@Model.Platform?.Type.ToString()</td>
            <td>@Model.Platform?.Version</td>
        </tr>
        <tr>
            <th>Engine</th>
            <td>@Model.Engine?.Type.ToString()</td>
            <td>@Model.Engine?.Version</td>
        </tr>
        <tr>
            <th>Crawler</th>
            <td>@Model.Crawler?.Type.ToString()</td>
            <td>@Model.Crawler?.Version</td>
        </tr>
    </tbody>
</table>
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.0 225 1/18/2023
4.10.4 139 1/17/2023
4.10.3 148 1/10/2023
4.10.2 210 1/3/2023
4.10.1 159 12/31/2022
4.10.0 558 12/27/2022
4.9.0 198 12/23/2022
4.8.0 250 11/30/2022
4.7.0 189 11/28/2022
4.6.0 185 11/27/2022
4.5.0 189 11/26/2022
4.4.0 193 11/24/2022
4.3.0 189 11/24/2022
4.2.0 226 11/15/2022
4.1.0 221 11/9/2022
4.0.0 213 11/9/2022
3.5.2 632 9/27/2022
3.5.1 308 9/19/2022
3.5.0 439 9/13/2022
3.4.0 291 9/13/2022
3.3.300 330 9/9/2022
3.3.200 407 8/23/2022
3.3.100 292 8/21/2022
3.2.0 1,610 6/23/2022
3.1.0 1,028 3/6/2022
3.0.0 963 2/9/2022
3.0.0-alpha3 82 2/9/2022
3.0.0-alpha2 79 2/8/2022
3.0.0-alpha1 106 2/4/2022
2.0.1 13,108 9/25/2020
2.0.0 15,871 12/29/2019
2.0.0-beta15 541 12/27/2019
2.0.0-beta14 459 12/25/2019
2.0.0-beta13 771 12/8/2019
2.0.0-beta12 2,827 8/2/2019
2.0.0-beta11 1,223 5/2/2019
2.0.0-beta04 663 5/3/2019