Avoid duplicating a large application

I run a very large web application (currently about 80 ASPX pages). This is shared between our customers (for example, they all access the same application at the same URL).

I also upload individual ASPX pages to a live server, rather than a compiled version, to allow me to work on different parts of the site at different times.

Now I have a problem when a new client wants to host the application directly on their own server. This will be due to the modification of about 3 pages before loading.

I have never encountered this problem before, but do you have the opportunity to avoid duplication of the entire application only for those minor changes? In the future, I will need to manage the original application, as well as my own version of the client, but it is not necessary to download each new version twice, as well as manage different versions of the changed 3 pages.

+4
source share
2 answers

I have done such things before, and I think that in just 3 pages the whole new โ€œplugโ€ is full. Not that I say, "Don't use source control." (Better to use some kind of source of control). But for three pages, I think the simplest solution is a simple redirect logic.

I assume that when these specific users log into your system, you have some kind of โ€œglobal variableโ€ that indicates that they are members of this company. On the 3 pages you are trying to replace, just put something like if (companyName == "specialCompany") Server.Transfer("specialCompanyDirectory/anotherPage.aspx"); or something else. I would recommend putting all three replaced pages in a separate directory, just for the sake of common sense. Then, at the top of each page in the "specialCompanyDirectory", make sure that the current user is indeed a member of the "specialCompany".

Depending on the logic of your application and pages, you may need to do something other than redirecting; for example, using separate web-based user management.

In any case, creating an entire standalone application for a 3-page change seems wrong. If you're going to change a whole bunch of pages, check out the TFS branches, SVN forks, or other piece of software.

EDIT:

As a rule, branches are designed to remain independent until you merge them. If you always kept them, and separate branches developed, they had nothing in common with each other; therefore, if you want to make a small change to one of these 3 pages in the "main" branch, you will have to go and make changes again to the "specialCompany" branch.

I suggest you use the method that I originally described above, since you have so few rights. I suggest you use some kind of global method to decide when to use a special method so that you can keep track of where you are making these special changes. For example, add a method somewhere in your App_Code that looks something like this:

 public String companySpecialMethod() { if (Request.ServerVariables["HTTP_HOST"].ToString().ToLower().Contains("somespecialdomain.com")) { return "somespecialdomain"; } else if (Request.ServerVariables["HTTP_HOST"].ToString().ToLower().Contains("anotherspecialdomain.com")) { return "anotherspecialdomain"; } else return ""; } 

Then in your code, you can just do something like:

 if (companySpecialMethod() == "") { //run a normal method normalMethod(); } else if (companySpecialMethod() == "somespecialdomain") { //run a special method, just for somespecialdomain somespecialdomainMethod(); } else if (companySpecialMethod() == "anotherspecialdomain") { //run a special method, just for anotherspecialdomain anotherspecialdomainMethod(); } 

BUT

If you really want to use Source Control for this solution (which might be a better idea if you think you are going to do a lot of this type of thing), you can try the following:

enter image description here

Assuming you want all your code to be in the repository: you basically create one repository (main repository) that contains ONLY code that is exactly the same for all projects. Thus, the entire base code will remain up to date; any changes you make in your regular project will also apply to your special projects.

(You do not need to do this next part, but it is best to use all your code in some form of source control) Then you create a new repository for each of your "special" directories.

This method ensures that you have all of your code in Source Control and that you do not have to duplicate the changes in your base code.

As for version control software, I prefer SVN , but it's just me. :) TFS is also a good product and works similar to SVN.

+2
source

First of all, 80 pages are quite small.

Secondly, source control would be good.

Is there a MSDN license? Access to the TFS service is available for no more than five users.

+1
source

All Articles