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
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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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
7.8.0 1,414 11/27/2023
7.7.0 480 11/23/2023
7.6.0 499 11/17/2023
7.5.0 498 11/15/2023
7.4.0 83 11/1/2023
7.3.0 188 10/22/2023
7.2.0 88 9/28/2023
7.1.0 69 9/21/2023
7.0.0 786 7/20/2023
6.2.0 887 7/7/2023
6.1.0 728 7/1/2023
6.0.0 774 6/28/2023
5.4.0 1,181 6/16/2023
5.3.1 939 6/7/2023
5.3.0 1,105 5/15/2023
5.2.0 768 5/11/2023
5.1.1 920 4/13/2023
5.1.0 1,245 4/3/2023
5.0.0 978 1/18/2023
4.10.4 911 1/17/2023
4.10.3 924 1/10/2023
4.10.2 994 1/3/2023
4.10.1 914 12/31/2022
4.10.0 3,229 12/27/2022
4.9.0 961 12/23/2022
4.8.0 1,027 11/30/2022
4.7.0 896 11/28/2022
4.6.0 926 11/27/2022
4.5.0 958 11/26/2022
4.4.0 929 11/24/2022
4.3.0 969 11/24/2022
4.2.0 966 11/15/2022
4.1.0 975 11/9/2022
4.0.0 950 11/9/2022
3.5.2 1,930 9/27/2022
3.5.1 1,055 9/19/2022
3.5.0 1,282 9/13/2022
3.4.0 1,025 9/13/2022
3.3.300 1,070 9/9/2022
3.3.200 1,255 8/23/2022
3.3.100 1,021 8/21/2022
3.2.0 2,320 6/23/2022
3.1.0 1,820 3/6/2022
3.0.0 2,203 2/9/2022
3.0.0-alpha3 735 2/9/2022
3.0.0-alpha2 722 2/8/2022
3.0.0-alpha1 745 2/4/2022
2.0.1 25,545 9/25/2020
2.0.0 18,043 12/29/2019
2.0.0-beta15 1,320 12/27/2019
2.0.0-beta14 1,194 12/25/2019
2.0.0-beta13 1,524 12/8/2019
2.0.0-beta12 3,647 8/2/2019
2.0.0-beta11 2,021 5/2/2019
2.0.0-beta04 1,411 5/3/2019