ScientificReport
HomeController.cs
Go to the documentation of this file.
1 using System;
2 using System.Diagnostics;
3 using Microsoft.AspNetCore.Http;
4 using Microsoft.AspNetCore.Localization;
5 using Microsoft.AspNetCore.Mvc;
7 
8 namespace ScientificReport.Controllers
9 {
10  public class HomeController : Controller
11  {
12  public IActionResult Index() => View();
13 
14  public IActionResult AccessDenied() => View();
15 
16  public IActionResult SetLanguage(string culture, string returnUrl)
17  {
18  Response.Cookies.Append(
19  CookieRequestCultureProvider.DefaultCookieName,
20  CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
21  new CookieOptions
22  {
23  Expires = DateTimeOffset.UtcNow.AddYears(1),
24  IsEssential = true
25  }
26  );
27 
28  return Redirect(returnUrl);
29  }
30 
31  [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
32  public IActionResult Error()
33  {
34  return View(new ErrorViewModel {RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier});
35  }
36  }
37 }
IActionResult SetLanguage(string culture, string returnUrl)