I need some help I have been working on a way to load a page from within the program.cs file created by VS 2017 and asp.net Razor but I can not work out how this is done I have look on the web to find the answer but for the life of me, I cannot find anything that will work. What I'm looking to do is after a lookup I need to load the page again with an added searchstring, I have all the code doing the lookup and cross-checking but I'm unable to get the code to redirect to the page again with the added searchstring.
Response.Redirect("/machinery?MachineLocation=" + searchstring);
The above code will not work in program.cs or startup.cs but will work in any cshtml.cs file.
I have tried to DI the Httpcontext but this keeps returning null. any pointers would be great.