ASP.NET Virtual Directory for General Labeling

I have several applications that need to share a common set of markup.

Scenario: I can have www.site1.com, www.site2.com and www.site3.com. All sites / care / contact -us.aspx and / care / faqs.aspx will be exactly the same, but every other page will be completely different.

Problem: I try not to duplicate .aspx files for each of these sites and would like to have a / care virtual directory that will include contact-us.aspx and faqs.aspx that each of these sites will use. I saw this post from Scott Gu , but I'm looking for any other solutions / ideas.

Question 1: What would be the best way to set this up for sharing the / care directory? Question 2: Any ideas on code sharing.

Background, if you are interested: in an outdated application (asp classic / vbscript) we have the ability to use the / shared virtual directory for sites to exchange common markup and code (since they are all mixed together .asp files).

Thanks in advance for any help or ideas!

+3
source share
3 answers

Just configure the virtual directory in IIS for each application that points to the same physical directory.

Here is a good link:

http://support.microsoft.com/kb/324785

+1
source

, , scott gu, , , svn: externals subversion "" . Subversion. , , - , .

+1

HTML . ASPX - .

HTML, , ( - HTML ). (, "ShowContent.aspx" ), HTML, ASP. , ASPX .

, . , JUST ASPX, (http://shared.yoururl.com). , , WebRequest:

        WebRequest wrContent = WebRequest.Create("http://shared.yoururl.com/CommonInformation.aspx");
        Stream objStream = wrContent.GetResponse().GetResponseStream();
        StreamReader objStreamReader = new StreamReader(objStream);
        string pageContent = objStreamReader.ReadToEnd();

Then display pageContent on a blank page.

If your shared pages are data entry formats, I am afraid that your only hope is to place them in a shared source directory that shares several projects. You would share the source, but publish the files with each project. This is likely to be messy: you can make changes to one that violates other projects, because now they have the possibility of interdependence.

0
source

Source: https://habr.com/ru/post/1731100/


All Articles