You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Threading.Tasks; |
|
using Microsoft.AspNetCore.Mvc; |
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
|
using Microsoft.Extensions.Logging; |
|
|
|
namespace StateJobsNYSubmit.Pages |
|
{ |
|
public class IndexModel : PageModel |
|
{ |
|
private readonly ILogger<IndexModel> _logger; |
|
public int counter = 1; |
|
private PrivateData p = new PrivateData(); |
|
public IndexModel(ILogger<IndexModel> logger) |
|
{ |
|
_logger = logger; |
|
} |
|
|
|
public void OnGet() |
|
{ |
|
string cookieValue = Request.Cookies["PrivateData"]; |
|
if (cookieValue != null) { |
|
string test = p.DecryptString(cookieValue); |
|
counter = Int32.Parse(test); |
|
counter++; |
|
} |
|
Response.Cookies.Append("PrivateData", p.EncryptString($"{counter}")); |
|
Console.WriteLine($"Value of counter: {counter}"); |
|
|
|
} |
|
} |
|
}
|
|
|