I am calling a function that is trying to grab the HTML output from a MVC razor view, and pass me the HTML output as a string.
here's my code:
Dim ControllerContext As New ControllerContext
ControllerContext.RouteData.Values.Add("id", reqID)
ControllerContext.RouteData.Values.Add("controller", "po")
Dim viewResult As ViewEngineResult = ViewEngines.Engines.FindPartialView(ControllerContext, "print")
Dim viewContext As ViewContext = New ViewContext(ControllerContext, viewResult.View, ViewData, TempData, sw)
viewResult.View.Render(viewContext, sw)
viewResult.ViewEngine.ReleaseView(ControllerContext, viewResult.View)
Dim strHTML As String = sw.GetStringBuilder().ToString()
It fails on the line "viewResult.View.Render(viewContext,sw) with the error -- System.NotImplementedException: The method or operation is not implemented.
I really want to be able to call this from a CRON JOB/script. Not only from an MVC page HTTP POST. Maybe that makes a difference? Because, I previously had this working, when it was called from HTTP POST method within the controller. Now, from my script, I'm calling a VB function (that resides in a separate class) that calls this function with the FindPartialView stuff (that resides in my POController).