项目之间共享aspx页面 [英] Share aspx page between projects

查看:253
本文介绍了项目之间共享aspx页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有多个Web项目的解决方案,并有一些网页,应该是present在其中几个。因此,我们需要某种形式的包含ASPX文件的共享文件的项目,并且可以被其他Web项目引用。

We have a solution with multiple web projects, and there are some pages that should be present in several of them. So we'd need some sort of a shared project which contains aspx files, and which can be referenced by other web projects.

现在有几个实现了有:

一个实现通过ScottGu 描述,涉及建筑共享的项目,不是复制输出ASPX到宿主项目,并引用ASPX的DLL。这种方法的缺点是,如果apsx被修改它必须被重新复制

One implementation described by ScottGu which involves building the shared project, and than copying the output aspx into the host project, and referencing the dll of the aspx. This method has the disadvantage that if the apsx gets modified it must been recopied.

另一种选择,根据<一href=\"http://blogs.msdn.com/b/davidebb/archive/2005/10/31/turning-an-ascx-user-control-into-a-redistributable-custom-control.aspx\"相对=nofollow>大卫Ebbo的帖子将在ASPX转换成ASCX-ES可作为定制控件来引用,并且比包括一些占位内的自定义控制ASPX-ES插入主机项目页面。但我的担忧:都可以apsx页面转换成ASCX?我的意思是有一个在例如用户控件没有Page.LoadComplete事件。

Another option, based on David Ebbo's post would be to convert the aspx into ascx-es which can be referenced as custom controls, and than include those custom-control-aspx-es into the host project inside of some placeholder pages. But my concerns are: can all apsx pages transformed into an ascx? I mean there's no Page.LoadComplete event in user controls for example.

和另一种选择是使用映射到共享webproject,如在微软 KB描述虚拟目录文章。用这种方法再次的问题是,共享的aspx-ES必须在predefined目录(即虚拟目录)。
如果虚拟目录的名称重叠的物理目录,可以使用该虚拟覆盖它并没有页从后者。
它是也许可以将两个合并到一起?

And yet another option is to use virtual directories that map into the shared webproject, as described in a Microsoft KB article. The problem again with this method is that the shared aspx-es must be in predefined directories(that is the virtual directory). If the name of virtual directory overlaps a physical directory, the virtual overrides it and no pages from the latter can be used. Is it perhaps possible to merge these two together?

有什么想法?提前致谢
附:如何调试共享页面?

Any thoughts? Thanks in advance P.S. How about debugging the shared pages?

推荐答案

我通过共享类库包含的.ascx控件解决了这个问题。从.aspx页转换为.ASCX控件时,还没有找到真正的困难。发现该样品由ScottGu非常简单和良好的开端。 http://webproject.scottgu.com/CSharp/usercontrols/usercontrols.aspx

I solved this problem by making shared Class Library that contains .ascx controls. Have not found real difficulties when converting from .aspx pages to .ascx controls. Found this sample by ScottGu really simple and good place to start. http://webproject.scottgu.com/CSharp/usercontrols/usercontrols.aspx.

这篇关于项目之间共享aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆