Question

We have a legacy ASP.NET 2.0 Webforms Web Site that we need to extend. It is poorly designed, and the architecture forces many files to be duplicated.

Whenever we add new functionality we are forced to physically copy our pages+code behind for "Weekly" versions of our products to other folders for our "Daily" products. For obvious reasons, this makes updates very annoying, since we need remember to update 2 copies of each file. Although the Weekly and Daily versions can differ, this rarely happens, so they usually have to be identical and exactly in syc.

Is there a way to create links/shortcuts in Windows or Visual Studio, so that we only need to create pages for our "weekly" products, and if a page is requested from the corresponding "daily" product, ASP.NET would transparently serve the "weekly" page, unless we physically subsitute a modified "daily" page? Bonus points if we can fool VS 2012 as well.

Clarification 1: We have folders like /Products/ProductAMonthly/Price.aspx and /Products/ProductADaily/Price.aspx The products are set up in a config file, and a framework does the routing. Unfortunately, the config file forces each product into a separate folder on the server, so we can't get the config file to reuse pages.

We have also refactored into base classes, and could perhaps refactor some more, but this doesn't get rid of the need for identical pages to exist in the folders defined in the config file.

Was it helpful?

Solution 2

I eventually used a Windows feature called Symbolic Links (or Junctions). ASP.NET/IIS seems to serve these up without problems. We have a batch file that uses mklink to create these on each developer's machines. We also added the junctioned files to our source control's ignore file. It seems to work well.

OTHER TIPS

If a daily product is suppose to display the same data as the weekly, in the code behind for a Daily product, you could do a server.transfer("Url for Weekly Product")

In the event the daily product is different than the weekly, you don't use a server.transfer, and you implement the desired daily business logic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top