0

All:

We started off our project using ASP.NET Web Forms.

We decided to integrate ASP.NET MVC 4 into our project.

We would like to leave the existing .aspx ASP.NET Web Form pages as it is already.

It would be too much work effort for now to move the existing functionality in .aspx ASP.NET Web Forms to ASP.NET MVC 4.

However, we want new functionality to use ASP.NET MVC 4 technology.

So I created a Global.asax.cs file.

I've taken into consideration existing .aspx ASP.NET Web Form pages by including the following line of code which is a catch-all route for .aspx ASP.NET Web Form pages:

routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");

The Global.asax.cs also contains URL route mappings to ASP.NET MVC Views.

routes.MapRoute(
             "Default",
             // Route name
             "{controller}/{action}/{id}",
            // URL with parameters
            new { controller = "Home", action = "Index", id = "" }
            // Parameter defaults
            );

Here's what I don't like about ASP.NET MVC.
I don't like configuring the URL route mappings to ASP.NET MVC Views in a compiled C# file. I believe that configurations like URL route mappings to ASP.NET MVC Views should be in some kind of xml file.

What do we have to do in order to push configurations like URL route mappings to ASP.NET MVC Views to an XML file?

crazyTech
  • 1,379
  • 3
  • 32
  • 67
  • Also, I would like to mention that in JEE technologies, configuration of mappings to Views in JSF MVC and Struts MVC would always be in an XML file like faces-config.xml and struts-config.xml which is the proper practice because we don't want to recompile. In other words, we can just modify the xml, and restart the server. – crazyTech Apr 11 '13 at 20:58

1 Answers1

2

Do you really need to change urls on production without changind something in code? It is really an odd situation. But anyway there are no any out of box way of doing this. However, nothing prevents you from creating your own section in web.config, then reading it in the Application_Start and calling routes.MapRoute() for every row in the section. But i am pretty sure i don't need it.

Vasiliy Shiryaev
  • 600
  • 4
  • 12
  • Maybe Not in Production Server. However, it's probably worthwhile to have that kind of functionality on a development server or a QA server because it reduces testing time. – crazyTech Apr 11 '13 at 22:36