Frage

I manage a very large web/database application (currently about 80 ASPX pages). This is shared across our clients (e.g. they all access the same application at the same URL).

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

I now have a challenge where a new client wants to host the application themselves on their own server. This will involve modifying about 3 pages before uploading.

I've never faced this challenge before, but is there a away to avoid duplicating the whole application just for those minor changes? In future I will need to manage the original application, plus the client's own hosted version, but don't necessarily want to upload each new version twice, and also managed different versions of the modified 3 pages.

War es hilfreich?

Lösung

I've done this sort of thing before and I think that for only 3 pages a whole new "fork" is overkill. Not that I'm saying, "Don't use source control". ( You BETTER be using some kind of source control ) But for three pages, I think the easiest solution is some simple redirect logic.

I assume that when these specific users are logged into your system that you have some sort of 'global variable' that indicates that they are a member of the company in question. In the 3 pages that you are trying to replace, just put something like if (companyName == "specialCompany") Server.Transfer("specialCompanyDirectory/anotherPage.aspx"); or something. I'd recommend putting all three replaced pages into a separate directory, just for sanity sake. Then at the top of each page in the "specialCompanyDirectory" be sure to check that the current user is indeed a member of "specialCompany".

Depending on the logic of your application and pages, you might need to do something other than a redirect; like using a separate Web User Control.

Either way, creating a whole separate application for a 3-page-change seems like the wrong method. If you're going to be changing a whole bunch of pages, look into the TFS branches, SVN forks or another piece of software.

EDIT:

Generally, branches are designed to remain independent until you eventually merge them. If you were to keep them eternally disparate, while the individual branches are being developed, they have nothing to do with one another; so if you were to make a small change to one of these 3 pages in the 'main' branch, you would then have to go and make the change again in the 'specialCompany' branch as well.

I suggest that you use the method I originally described above, since you have so few edits. I suggest that you use some sort of global method to decide when to use a special method just 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();
}

HOWEVER

If you really want to use Source Control for this solution ( which may be the best idea if you are thinking that you are going to be doing lots of this type of thing ) then you could try this:

enter image description here

Assuming that you want all your code in a repository: You basically create one repository (Main Repository) that contains ONLY the code that is exactly the same across all projects. This way all your base code will remain up to date; any changes that you make in your normal project will propagate to your special projects as well.

( You don't have to do this next part, but it's Best Practice to have all your code in some sort of Source Control ) Then you create a new repository for each of your 'special' directories.

This method will ensure that you will have all your code in Source Control and that you won't have to duplicate changes to your 'Base' Code.

As far as Source Control software, I prefer SVN, but that's just me. :) TFS is a good product as well, and works similarly to SVN.

Andere Tipps

First of all, 80 pages is pretty small.

Second, source control would be a good thing.

Have an MSDN License? TFS Service access for up to five users is free.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top