Try our conversational search powered by Generative AI!

How to use web api attribute routingg


Is there any way to use attribute routing in an EPiServer 7.5 MVC site?
I tried to set this in the WebApiConfig class

    public static class WebApiConfig
        public static void Register(HttpConfiguration config)

    and i have this in the global.asax.

        protected void Application_Start()
            // Register Display Options
            var options = ServiceLocator.Current.GetInstance<DisplayOptions>();
                .Add("full", "/displayoptions/full", ContentAreaTags.FullWidth, "", "epi-icon__layout--full")
                .Add("wide", "/displayoptions/wide", ContentAreaTags.TwoThirdsWidth, "", "epi-icon__layout--two-thirds")
                .Add("narrow", "/displayoptions/narrow", ContentAreaTags.OneThirdWidth, "", "epi-icon__layout--one-third");


    This is a sample api controller I use.

namespace EPiServer.Templates.Alloy.Controllers.Api
    public class PageInfo : ApiController
        // GET api/<controller>
        public IEnumerable<string> Get()
            return new string[] { "value1", "value2" };

Any help would be much appreciated.
Feb 28, 2014 3:27

Sure, this should be possible. I used Web API 2.0 in this blog post about creating an auto suggest property:

Feb 28, 2014 7:28

Can it be for HttpPost ?

Mar 16, 2023 20:45
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.