Hello,
I have an older Razor .Net6 project running with ServiceStack v6.5.0
I am using the Fallback service to get to the home page and also do some redirections …
that code was working
[FallbackRoute("/{Path*}")]
public class Fallback
{
public string Path { get; set; }
}
public object Any(Fallback request)
{
if (string.IsNullOrWhiteSpace(request.Path))
{
// This is the home page as we have a view for it and did not place it in the root
//return Gateway.Send(new PageDefault());
var razor = GetPlugin<RazorFormat>();
var view = razor.GetViewPage("default");
if (view == null)
throw HttpError.NotFound("Razor view not found: " + "default");
var modelResponse = Gateway.Send(new PageDefault());
return razor.RenderToHtmlAsync(view, modelResponse).Result;
}
...
and we have default.cshtml
in the /Views
folder and a PageDefault
service
[DefaultView("default")]
public PageDefaultResponse Get(PageDefault request)
{
...
}
That code was working in version 6.5.0 using your new GetViewPage
, trying to upgrade to 6.10.0, I am getting an error in the Fallback call
Unable to cast object of type ‘ServiceStack.Host.BasicRequest’ to type ‘ServiceStack.Web.IHttpRequest’.
Do you have an idea?
Thierry