I want to display a view after facebook authentication in my application but I'm getting the json response instead the html view, according to the documentation the view resolution is the following:
The resolution order ServiceStack's uses to resolve the appropriate Markdown template to use for rendering HTML output is:
- If the Web Service specifies a template (via a customized IHttpResult.TemplateName response) - then a View with that name.
- A view with the same name as the Response DTO, looking first in /Views then in /Views/Shared
- A view with the same name as the Request DTO, looking first in /Views then in /Views/Shared
these are my DTOs
public class FacebookRequest{}
public class FacebookResponse{}
this is my route configuration
Routes.Add<FacebookRequest>("/User/facebook");
my view has the folloing code:
@inherits ViewPage<MyProject.Services.Dto.FacebookResponse>
this is a facebook response
Service method:
[ClientCanSwapTemplates]
public FacebookResponse Get(FacebookRequest userRequest)
{
return new FacebookResponse();
}
As far as I understand if I have a view located in the "views" directory with the same responseDTO it should wire the view with the response from the service.
FacebookResponse.cshtmlorFacebookResponse.md? Is it located in your /Views or /Views/Shared directory? Your question doesn't state that explicitly. - Pauli PriceViews/FacebookResponse.cshtmlexactly, it won't work. Using theinherits viewpagestatement doesn't help SS resolve the view. It's looking for the exact file name in a specific location. I'm not 100% on this - but I seem to recall that it was a case sensitive match too. - Pauli Price