RazorRockstars.Web has an implementation. I will modify it to use the default lookup template and view:
[FallbackRoute("/{Path*}")] public class Fallback { public string Path { get; set; } public string PathInfo { get; set; } } public class RockstarsService : Service { [DefaultView("Index")] public object Any(Fallback request) { request.PathInfo = base.Request.PathInfo; return request; }
Since this is a service, it requires a view page ( here) , not a content page.
In the RockStars example, I cannot determine which view will be displayed for FallBackResponse, but explicitly specifying the view should be all you need.
The [DefaultView("Index")] attribute added to the Any method displays the response to the Views / Index.cshtml file. The Index.cshtml file may be empty, but for the template declaration, and the full markup for your one-page application may be in your template file (i.e. _Layout.cshtml)
Without razor
Read the html in the line and return it by setting the content type to text / html with the attribute, see wiki docs when returning the service types
public class RockstarsService : Service { static string readContents; [AddHeader(ContentType = "text/html")] public string Any(Fallback request) {
Pauli Price
source share