-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeController.cs
53 lines (45 loc) · 1.31 KB
/
HomeController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using AppInsightsProfilerExample.Models;
namespace AppInsightsProfilerExample.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
SimulateDelay();
return View();
}
public IActionResult About()
{
SimulateDelay();
ViewData["Message"] = "Your application description page.";
return View();
}
public IActionResult Contact()
{
SimulateDelay();
ViewData["Message"] = "Your contact page.";
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
private void SimulateDelay()
{
// Delay for 500ms to 2s to simulate a bottleneck.
Thread.Sleep((new Random()).Next(500, 2000));
}
}
}