I have a project where I am passing the data from C# to cshtml by something like this:
public IActionResult Index()
{
ViewData["temp"] = "abc"
return View();
}
This value is then received in the cshtml file where I can read this as
var temp = ViewData["temp"];
I have a typescript file that is then booted from this cshtml file. My question is, how can I use this temp variable in my typescript code. I don't want to create a 'div' element for this temp data and then read its value in typescript as this will not be a clean thing to do from security perspective.
Can you please suggest some way to do it in a proper way?