I'm purposely not going to post code unless asked because we have all seen Return View("PartialView").
I have a webhook receiver method in my home controller to get responses from Square. All works as expected and I am able to receive the payload data without issue.
The problem that has been plaguing me for the last 3 days is the fact that at the end on the webhook method, there is the return View("PartialView"), but no TempData, ViewBag or Model is anything but null in the partial view that is indeed called.
I am beginning to surmise that because the call the the webhook method is coming from the outside world that return View("partial")'s various view data facilities break.
I can set ViewBag.WebHookData to "come on man"; and it's still null over in the partial view as if there are redirects. And model data which is supposed to be implicitly carried across to the partial view and Tempdata don't fare any better and are null.
I can find lots of "how do you make a web hook" google returns but not how to display webhook payload on the current view.
What do you veterans think?
Addendumb: The webhhook method is async Task fwiw. That means it's running in a different thread than the single threaded js in the view?
TIA
There I fixed it. :-)
The only thing that would work (not be null) was a public static string of square status over in the controller accessed via razor in the view. But it wasn't dynamic, for days..... Then I gave signalR a whirl (again) promising, no pun intended, to stick with it until I had got it working. I had always given up on it as to do what it was intended to do, dynamic web page update seemed fiddly and complex. But alas, desperate times called for patience and lo, it's working now. Square webhook status is now dynamically posted in a status area of the sales screen as point of sale events occur.
I know public static variables are frowned upon but it was the only thing that worked.