Search code examples
asp.net-mvcazureasp.net-web-apiroutesasp.net-web-api-routing

Controller virtual path is built incorrectly when application deployed in Azure environment


I have a working application in MVC.net which I am trying to migrate Azure environment.

Code to create virtual path to access controller is:

var populateEmailsUrl = '<%= Url.Action("PopulateEmailNotifications","ABC") %>';

where ABC is the controller name and PopulateEmailNotifications is the method name.

When accessed from any environment or localhost Azure it is rendered correctly as:

var populateEmailsUrl = '/appgroup/0021a/web/ABC/PopulateEmailNotifications/';

When accessed from azure public URL it is rendered as:

var populateEmailsUrl = '/appgroup/0021a/web/XYZ/PopulateEmailNotifications/';

XYZ is another controller in application

This is not true with all the controllers. Some of them are rendered correctly.


Solution

  • Moved my application from MVC 2 to MVC 3 and it solved my problem.