[英]ASP.NET Website inside Webforms application?
We've inherited an ASP.NET website. 我们继承了一个ASP.NET网站。 We've already converted it to a web application for different reasons.
由于各种原因,我们已经将其转换为Web应用程序。
But there are 2 folders with 2 .aspx pages inside that do some really kludgy things (creates a new aspx file with its corresponding code behind and save it inside one of those folders). 但是有2个文件夹,里面有2个.aspx页面,它们做一些真正的杂乱的事情(创建一个新的aspx文件,后面带有相应的代码,并将其保存在其中一个文件夹中)。
So when the project was a simple website, that worked because the created pages on runtime were compiled at request. 因此,当项目是一个简单的网站时,该项目之所以起作用,是因为在运行时创建的页面是根据请求编译的。 This is not applicable to a web application.
这不适用于Web应用程序。
We don't have time to re-code those ugly pages and do it as it should. 我们没有时间重新编码这些丑陋的页面,并按需进行。 So, is there a way to have those 2 pages (and the generated-at-runtime ones) excluded from the project and inside a website that is compiled at request?
因此,是否有办法将这两个页面(以及运行时生成的页面)排除在项目之外,而是在根据要求编译的网站内部? What other alternatives could you think of?
您还能想到其他什么选择?
You can multiple Web Applications on a single site by designating them as separate applications within separate Virtual Directories in IIS. 通过将它们指定为IIS中单独虚拟目录中的单独应用程序,可以在单个站点上使用多个Web应用程序。 For this, just create a new Virtual Directory in IIS, right-click and go to Properties.
为此,只需在IIS中创建一个新的虚拟目录,右键单击并转到“属性”。 Under the "Virtual Directory" tab, click Create.
在“虚拟目录”选项卡下,单击“创建”。 This will designate that Virtual Directory as a separate application.
这会将虚拟目录指定为单独的应用程序。
The end result will be that "mysite.dom/VirtualDirectory1" and "mysite.dom/VirtualDirectory2" will be separate applications that can even run under a different ASP.NET runtime. 最终结果将是“ mysite.dom / VirtualDirectory1”和“ mysite.dom / VirtualDirectory2”是单独的应用程序,甚至可以在不同的ASP.NET运行时下运行。
EDIT TO ADD that the downside of this is that the two applications are completely separate and cannot share Session or Application information. 编辑要补充一点,这样做的缺点是两个应用程序是完全分开的,并且不能共享会话或应用程序信息。 This can be easily solved via a Database or some other data store.
这可以通过数据库或其他数据存储轻松解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.