WebApi 2 HelpPage using ResponseType attribute instead of SetActualResponseType

In my previous post, Using Microsoft ASP.NET Web API 2 Help Page – Part 2 I mentioned that in MVC5, the HelpPage API, you no longer to specify the response type as part of the HelpPageConfig.

This was simplier than I thought it would be.

Using this GitHub commit of the PolicyController, The Get methods have no attributes. Within HelpPageConfig, we have the following code:

    "Policy", "Get");

This line needs to be removed.

On the PolicyController, add the following attribute to the Get methods


If required add a link to System.Web.Http;

Check the help page, and the samples are displayed correctly. Using Attributes just feels cleaner that adding multiple entries into the HelpPageConfig. Missing the attribute, you know that there will be a problem with the produced api documentation

Enhanced by Zemanta

My musing about anything and everything

Tagged with: , ,
Posted in Help Page, MotorDB, WebAPI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 13 other followers
%d bloggers like this: