Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Cannot Append to cookie in ASP.NET Core 2.0 MVC

$
0
0

Hello,

I am trying perform a very simple action

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
var mtaUserCookie = Request.Cookies["mtaUserRole"];
if (mtaUserCookie != null)
{
Response.Cookies.Delete("mtaUserRole");
}
try
{
var cookieName = "mtaUserRole";
Response.Cookies.Append(cookieName, "IsAppAdmin");
}
catch ( Exception e ){ e.Message.ToString(); } // no errors...

// debug code
var mtaUserCookie = Request.Cookies["mtaUserRole"]; // value is null here

Please help.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>