在ASP.NET中跨网站共享页面

时间:2022-08-10 03:21:46

Here at our company we are trying to figure out how to create one single page and share it across domains in ASP.NET.

在我们的公司里,我们正试图弄清楚如何创建一个单独的页面,并在ASP.NET的域*享它。

We would like to create a simple "cart" page that is the same for all of our clients websites, so that we can include the page from a central location (such as http://ourwebsite.com/thecart.aspx) without duplicating code, and still be able to apply the CSS styles and branding for each client to the page.

我们想要创建一个简单的“购物车”页面,为我们所有的客户都是一样的网站,这样我们可以包括从一个*位置的页面(例如http://ourwebsite.com/thecart.aspx),而不复制代码,并且仍然能够应用CSS样式和品牌为每个客户端页面。

How can we share a single page across websites in ASP.NET?

如何在ASP.NET中跨网站共享一个页面?

Each of our client's websites are on a different domain, and in some cases may also be on different servers as well.

我们的每个客户的网站都在不同的领域,在某些情况下也可能在不同的服务器上。

2 个解决方案

#1


2  

I think what you want to do is manage one page and have it automatically update the other pages on your client's sites, ideally the same thing as "sharing a resource" no? For that you don't necessarily need to "share" a page, you need an easy process for multiple site deployment of just the single page, errr....I think? In any case, without loading the page via an iframe, or creating a central spot like "cart.somedomain.net" and then pushing the info back and fourth (I assume you'll have shopping cart items), you'd need a way to automate the publish of the page on different sites.

我认为你想做的是管理一个页面,让它自动更新你客户网站上的其他页面,最好是和“共享资源”不一样?你不一定需要“共享”一个页面,您需要一个简单的流程为多个站点部署的单页,哦....我的想法吗?在任何情况下,如果不通过iframe加载页面,或者创建一个像“cart.somedomain.net”这样的中心位置,然后将信息推回去和第四(我假设您将有购物车条目),那么您需要一种方法来自动将页面发布到不同的站点上。

Even if you were to make the "cart" page it's own solution and then just include it in the individual sites, you'd still have the deployment issue. I think you have a few options, some of them previously mentioned:

即使您要创建“cart”页面,它是自己的解决方案,然后将其包含在各个站点中,您仍然会遇到部署问题。我认为你有一些选择,其中一些之前提到过:

  1. Create an iframe that loads the page from an external source.
  2. 创建一个从外部源加载页面的iframe。
  3. Create a central location for all the domains to push information to for their checkout process (store.somedomain.net or somdomain.net/cart.aspx) and handle it accordingly.
  4. 为所有域创建一个中心位置,将信息推送到它们的签出过程(store.somedomain.net或somdomain.net/cart.aspx),并相应地处理它。
  5. Create an application or script that automates the deployment of the updated resource to multiple sites (I don't know of a tool that does this or I would offer up the name to you, I apologize).
  6. 创建一个应用程序或脚本,将更新后的资源部署自动化到多个站点(我不知道有什么工具可以做到这一点,否则我将向您提供这个名称,抱歉)。

Anyway, I hope that helps, best of luck.

无论如何,我希望这能有所帮助,祝你好运。

#2


1  

Inherit from and create the page as just another server control in a custom library. You'll of course have it in source control.

继承并创建页面作为自定义库中的另一个服务器控件。当然,您将在源代码控制中使用它。

In fact, it doesn't need to be a "page", rather a custom server shopping cart control.

事实上,它不需要是一个“页面”,而是一个定制的服务器购物车控件。

#1


2  

I think what you want to do is manage one page and have it automatically update the other pages on your client's sites, ideally the same thing as "sharing a resource" no? For that you don't necessarily need to "share" a page, you need an easy process for multiple site deployment of just the single page, errr....I think? In any case, without loading the page via an iframe, or creating a central spot like "cart.somedomain.net" and then pushing the info back and fourth (I assume you'll have shopping cart items), you'd need a way to automate the publish of the page on different sites.

我认为你想做的是管理一个页面,让它自动更新你客户网站上的其他页面,最好是和“共享资源”不一样?你不一定需要“共享”一个页面,您需要一个简单的流程为多个站点部署的单页,哦....我的想法吗?在任何情况下,如果不通过iframe加载页面,或者创建一个像“cart.somedomain.net”这样的中心位置,然后将信息推回去和第四(我假设您将有购物车条目),那么您需要一种方法来自动将页面发布到不同的站点上。

Even if you were to make the "cart" page it's own solution and then just include it in the individual sites, you'd still have the deployment issue. I think you have a few options, some of them previously mentioned:

即使您要创建“cart”页面,它是自己的解决方案,然后将其包含在各个站点中,您仍然会遇到部署问题。我认为你有一些选择,其中一些之前提到过:

  1. Create an iframe that loads the page from an external source.
  2. 创建一个从外部源加载页面的iframe。
  3. Create a central location for all the domains to push information to for their checkout process (store.somedomain.net or somdomain.net/cart.aspx) and handle it accordingly.
  4. 为所有域创建一个中心位置,将信息推送到它们的签出过程(store.somedomain.net或somdomain.net/cart.aspx),并相应地处理它。
  5. Create an application or script that automates the deployment of the updated resource to multiple sites (I don't know of a tool that does this or I would offer up the name to you, I apologize).
  6. 创建一个应用程序或脚本,将更新后的资源部署自动化到多个站点(我不知道有什么工具可以做到这一点,否则我将向您提供这个名称,抱歉)。

Anyway, I hope that helps, best of luck.

无论如何,我希望这能有所帮助,祝你好运。

#2


1  

Inherit from and create the page as just another server control in a custom library. You'll of course have it in source control.

继承并创建页面作为自定义库中的另一个服务器控件。当然,您将在源代码控制中使用它。

In fact, it doesn't need to be a "page", rather a custom server shopping cart control.

事实上,它不需要是一个“页面”,而是一个定制的服务器购物车控件。