forum

Home / DeveloperSection / Forums / how to route the controller to a different name

how to route the controller to a different name

Pravesh Singh 1805 20-Sep-2014

Have a really basic thing to do - I need to expose a post API such as mobile/api/pswdrec which I wanna bind to my PasswordController to avoid that dull name. 

It's a webapi with areas and I'm trying both Attribute Routing and MapHttpRoute. neither works so far.

 
public class PasswordController : MobileApiControllerBase
{
    //[Route("api/mobile/pswdrec/")]
    public RestResponseMessage Post(UserCredentialsModel credentials)
    {
        return RestResponseMessage.OK();
    }
}

Checked the client side and the requests are proper json requests. It's starting to work when I simply change the name of the controller to PswdrecController. 

Is there any other way to "rename" the controller?


Updated on 20-Sep-2014

Can you answer this question?


Answer

1 Answers

Liked By