\r\n

51Degrees Pipeline .NET  4.1

51Degrees Pipeline for .NET

ExampleFrameworkWebSite/Controllers/HomeController.cs

ASP.NET core exampleThis example shows how to:

  1. Set up configuration options to add elements to the 51Degrees Pipeline.
    {
    "PipelineOptions": {
    "Elements": [
    {
    "BuilderName": "math"
    },
    {
    "BuilderName": "JavaScriptBundlerElement"
    }
    ],
    "ClientSideEnabled": true
    }
    }
  2. Configure client-side code to be run by enabling it in the Web.config.
    1 <configuration>
    2  <system.webServer>
    3  <modules runAllManagedModulesForAllRequests = "true" >
    4  ...
  3. Use the results contained in the Request.Browser instance to display something on a page view.
    public class HomeController : Controller
    {
    ...
    public IActionResult Index()
    {
    ViewData["Message"] =
    Request.Browser["math.operation"] + " = " + Request.Browser["math.result"];
    return View();
    }
    ...

Controller

/* ********************************************************************
* Copyright (C) 2019 51Degrees Mobile Experts Limited.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* ******************************************************************** */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewData["Message"] =
Request.Browser["math.operation"] +
" = " +
Request.Browser["math.result"];
return View();
}
}
}