0

Suppose I wanted to create multiple websites hosted on different servers, but I want some certain duplicate contents (e.g. news box that shows same headlines and news on both sites). The sites will be different, just the news box will have duplicate contents. What would be the best approach for this? I'm just thinking duplicating user control that pulls data off the same database or is this too noob?

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Muad Dib
0

There are many ways to accomplish this however I'm not sure what resources you have at your disposal. You could use a central database, RSS Feeds or even an HTTP Post to obtain the desired content from a page that has the content the domains need to display. Any of these could be wrapped into a user control. What flavor of .NET are you using (C#, VB)?

Kenny

0

Here is a small example of an HTTP Post. You could build this into a user control which you could drop onto any page on any domain. The url below in the code "http://www.somedomain.com/UniversalContent.aspx" should be replaced with a page or text file that holds the content you want to be used on any of the other domains. You could then even add a property to the control to define what content it pulls.

public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write(httpPost("http://www.somedomain.com/UniversalContent.aspx"));
        }

        string httpPost(string url)
        {
            System.Net.WebClient web = new System.Net.WebClient();

            web.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
            byte[] parameters = {};
            byte[] results = web.UploadData(url, "POST", parameters);

            return System.Text.Encoding.Default.GetString(results);
        }

    }

Does this make sense? Like I said before there are many ways to do this and this is just one quick easy way. I personally use a shared SQL server for this kind of a thing but it depends on what resources you have available. Let me know if it works out.

Thanks,
Kenny

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.