We have an existing classic ASP intranet consisting of hundreds of pages. Its directory structure looks like this...
我们有一个由数百页组成的经典ASP内部网。它的目录结构如下所示......
/root
app_1
app_2
...
img
js
style
Obviously app_1 and so on have better names in the actual directory structure.
显然app_1等在实际目录结构中有更好的名称。
Even though the many applications have different behaviour, they are all part of the same intranet and therefore share a common look and feel by including stylesheets via /style, images via /img and client script via /js.
尽管许多应用程序具有不同的行为,但它们都是同一个Intranet的一部分,因此通过/ style包含样式表,通过/ img包含图像,通过/ js包含客户端脚本,共享一个共同的外观和感觉。
The trouble (for me at least) comes when I want to add an intranet application in ASP.NET.
当我想在ASP.NET中添加内部网应用程序时,麻烦(至少对我而言)来了。
Ultimately, I'd like this structure:
最终,我想要这个结构:
/root
app_1
app_2
dotnetapp_1
dotnetapp_2
...
img
js
style
It seems to me that ASP.NET "applications" like to think of themselves as separate from everything around them (this may just be my comprehension of how they are). You create a new "project" in Visual Studio and it's like you have a new "root" a level below the actual root I want to use. It's like this new application is a thing, standing alone, with its own images and style and whatnot. However, I want it to be a sub-part of the existing intranet.
在我看来,ASP.NET“应用程序”喜欢将自己视为与周围的一切分开(这可能仅仅是我对它们的理解)。您在Visual Studio中创建一个新的“项目”,就像您有一个新的“根”级别低于我想要使用的实际根目录。这就像这个新的应用程序是一个独立的东西,有自己的图像和风格等等。但是,我希望它是现有内部网的子部分。
Ultimately I want to be able to make my whole classic ASP intranet the "root" and have ASP.NET "sub-applications" that can still access /style and /img and, I guess for ASP.NET I'll have /masterpages.
最终我希望能够使我的整个经典ASP内联网成为“根”并拥有仍然可以访问/样式和/ img的ASP.NET“子应用程序”,我想对于ASP.NET我将拥有/ masterpages 。
I've tried this before, but I think VS choked on the couple of hundred classic ASP pages that it added to the "project" when I made my existing intranet root directory the ASP.NET project root (via File->Open->Web Site). I'd be nice to edit my existing classic ASP intranet using VS 2008 SP1 (I currently use the excellent Notepad++) because I'd like to get more hands on with VS but I guess this isn't absolutely necessary.
我之前尝试过这个,但是当我将现有的Intranet根目录设置为ASP.NET项目根目录时(通过File-> Open->),我认为VS会阻塞它添加到“项目”中的几百个经典ASP页面。网站)。我很高兴使用VS 2008 SP1编辑我现有的经典ASP内部网(我目前使用优秀的Notepad ++),因为我想更多地使用VS,但我想这不是绝对必要的。
I also tried treating each new ASP.NET application as an application in its own right, effectively making the /dotnetapp_1 directory the "root" of the application (again, via File->Open->Web Site in VS2008). However, VS then complained when I tried to reference /masterpages because it "belonged to another application." I think I kludged it by adding a virtual directory inside each ASP.NET directory that "pointed" to the root /masterpages but I'm not sure VS was able to happily provide WYSIWYG editing when I did this, as opposed to making a copy of the masterpage in every ASP.NET application I add to the intranet.
我还尝试将每个新的ASP.NET应用程序本身视为一个应用程序,有效地使/ dotnetapp_1目录成为应用程序的“根”(同样,通过VS2008中的File-> Open-> Web站点)。然而,当我尝试引用/ masterpages时,VS然后抱怨,因为它“属于另一个应用程序”。我想我通过在每个ASP.NET目录中添加一个“指向”root / masterpages的虚拟目录来克服它,但我不确定VS是否能够在我这样做时愉快地提供WYSIWYG编辑,而不是制作副本我添加到Intranet的每个ASP.NET应用程序中的母版页。
I'm also quite likely to visit the .NET MVC framework so please offer any answers with that framework in mind. I'm hoping "projects" aren't quite to important with MVC and that rather it's just a bunch of files that creates an application that contributes to the whole (that being the intranet).
我也很有可能访问.NET MVC框架,所以请记住该框架的任何答案。我希望“项目”对于MVC来说并不重要,而只是它只是一堆文件创建了一个有助于整个(作为内部网)的应用程序。
So, the question is: How I can best add-on ASP.NET applications to an existing classic ASP intranet (I'm not concerned about the technicalities of session sharing between classic ASP and ASP.NET, only the structural layout of directories and projects) and be able to edit these separate applications in Visual Studio 2008 SP1 and yet have these application "related" to each other by a common, intranet look and feel*?
所以,问题是:我如何才能最好地将ASP.NET应用程序添加到现有的经典ASP内部网(我不关心经典ASP和ASP.NET之间的会话共享的技术性,只关注目录的结构布局和项目)并能够在Visual Studio 2008 SP1中编辑这些单独的应用程序,并使这些应用程序通过共同的Intranet外观相互“相关”*?
- Please don't just post the answer "use MasterPages." I appreciate MasterPages are .NET's method of sharing styles (and more probably) between related pages in the same application. I get that. What I'm looking for is the best method of adding ASP.NET applications into the existing intranet as smoothly as I can that makes editing each application simple and where each application can share (if possible) an intranet-common style.
请不要只回答“使用MasterPages”。我很欣赏MasterPages是.NET在同一个应用程序中相关页面之间共享样式(更可能)的方法。我明白了。我正在寻找的是尽可能顺利地将ASP.NET应用程序添加到现有Intranet中的最佳方法,这使得编辑每个应用程序变得简单,并且每个应用程序可以共享(如果可能)Intranet共同样式。
4 个解决方案
#1
2
One solution would be to use IIS Manager to configure the website (created for your ASP.NET app by Visual Studio) and add a virtual directory for each of the common folders so that (by the 'virtual' nature of the virtual directory) they will 'appear' to be in the same root folder as your ASP.NET app.
一种解决方案是使用IIS管理器配置网站(由Visual Studio为您的ASP.NET应用程序创建)并为每个公共文件夹添加一个虚拟目录,以便(通过虚拟目录的“虚拟”特性)将“显示”与ASP.NET应用程序位于同一根文件夹中。
/root
app_1
app_2
dotnetapp_1
<virtual>img
<virtual>js
...
img
js
style
You can probably script IIS or edit an XML file if you need to do this in bulk, and I'm sure there must be an even more elegant way to do something similar that doesn't require to much mouse work!
如果你需要批量执行此操作,你可以编写IIS脚本或编辑XML文件,我相信必须有更优雅的方法来做类似的事情,不需要太多的鼠标工作!
#2
2
Since ASP.NET is now the Microsoft standard web development platform, you might be better off starting with a brand-new ASP.NET web site and importing your existing ASP pages and folders into it. Once you have that set up and running, adding new functionality in ASP.NET will be a snap.
由于ASP.NET现在是Microsoft标准Web开发平台,因此最好从一个全新的ASP.NET网站开始,并将现有的ASP页面和文件夹导入其中。一旦设置并运行,在ASP.NET中添加新功能将非常简单。
Microsoft understood that some customers would be mixing classic ASP and ASP.NET for awhile, and they accomodated this need by making classic ASP pages work within an ASP.NET site. What you're trying to do is the reverse of this (get ASP.NET to work within ASP, sorta), and you're already running into difficulties.
微软了解到一些客户会将经典ASP和ASP.NET混合使用一段时间,并且他们通过使经典ASP页面在ASP.NET站点内工作来满足这一需求。你要做的就是反过来(让ASP.NET在ASP中运行,sorta),你已经遇到了困难。
#3
0
Can't you run the asp.net site as a Virtual Directory?
你不能将asp.net网站作为虚拟目录运行吗?
www.site.com/dotnetapp/
Where dotnetapp is a virtual directory completely separate?
dotnetapp是一个完全独立的虚拟目录?
#4
0
Couple different ways to go about this:
结合不同的方式:
- If your listed folder structure is the desired web folder structure, then any of your ASP.NET applications can simply reference /root/js/whatever.js or ../js/whatever.js and it'll get to the folders you already have at the root. This is an alternative to the virtual directories solution already mentioned. This is a rather messy solution, which some of the projects I've inherited at my current job do.
- At a previous job I managed a hybrid Classic ASP/ASP.NET application for a couple years and I did it by making an ASP.NET Web Application at the root and moving all my ASP pages into it. Any "sub-applications" you want to make should just be folders in this single project. [ASP pages don't have color-coding in VS2008 anymore though, which was really annoying.]
如果列出的文件夹结构是所需的Web文件夹结构,那么任何ASP.NET应用程序都可以简单地引用/root/js/whatever.js或../js/whatever.js,它将到达您已经存在的文件夹有根源。这是已经提到的虚拟目录解决方案的替代方案。这是一个相当混乱的解决方案,我在目前的工作中继承了一些项目。
在以前的工作中,我管理了一个混合的Classic ASP / ASP.NET应用程序几年,我通过在根目录下创建一个ASP.NET Web应用程序并将所有ASP页面移入其中来实现。您想要制作的任何“子应用程序”应该只是这个单个项目中的文件夹。 [ASP页面在VS2008中不再有颜色编码了,这真的很烦人。]
#1
2
One solution would be to use IIS Manager to configure the website (created for your ASP.NET app by Visual Studio) and add a virtual directory for each of the common folders so that (by the 'virtual' nature of the virtual directory) they will 'appear' to be in the same root folder as your ASP.NET app.
一种解决方案是使用IIS管理器配置网站(由Visual Studio为您的ASP.NET应用程序创建)并为每个公共文件夹添加一个虚拟目录,以便(通过虚拟目录的“虚拟”特性)将“显示”与ASP.NET应用程序位于同一根文件夹中。
/root
app_1
app_2
dotnetapp_1
<virtual>img
<virtual>js
...
img
js
style
You can probably script IIS or edit an XML file if you need to do this in bulk, and I'm sure there must be an even more elegant way to do something similar that doesn't require to much mouse work!
如果你需要批量执行此操作,你可以编写IIS脚本或编辑XML文件,我相信必须有更优雅的方法来做类似的事情,不需要太多的鼠标工作!
#2
2
Since ASP.NET is now the Microsoft standard web development platform, you might be better off starting with a brand-new ASP.NET web site and importing your existing ASP pages and folders into it. Once you have that set up and running, adding new functionality in ASP.NET will be a snap.
由于ASP.NET现在是Microsoft标准Web开发平台,因此最好从一个全新的ASP.NET网站开始,并将现有的ASP页面和文件夹导入其中。一旦设置并运行,在ASP.NET中添加新功能将非常简单。
Microsoft understood that some customers would be mixing classic ASP and ASP.NET for awhile, and they accomodated this need by making classic ASP pages work within an ASP.NET site. What you're trying to do is the reverse of this (get ASP.NET to work within ASP, sorta), and you're already running into difficulties.
微软了解到一些客户会将经典ASP和ASP.NET混合使用一段时间,并且他们通过使经典ASP页面在ASP.NET站点内工作来满足这一需求。你要做的就是反过来(让ASP.NET在ASP中运行,sorta),你已经遇到了困难。
#3
0
Can't you run the asp.net site as a Virtual Directory?
你不能将asp.net网站作为虚拟目录运行吗?
www.site.com/dotnetapp/
Where dotnetapp is a virtual directory completely separate?
dotnetapp是一个完全独立的虚拟目录?
#4
0
Couple different ways to go about this:
结合不同的方式:
- If your listed folder structure is the desired web folder structure, then any of your ASP.NET applications can simply reference /root/js/whatever.js or ../js/whatever.js and it'll get to the folders you already have at the root. This is an alternative to the virtual directories solution already mentioned. This is a rather messy solution, which some of the projects I've inherited at my current job do.
- At a previous job I managed a hybrid Classic ASP/ASP.NET application for a couple years and I did it by making an ASP.NET Web Application at the root and moving all my ASP pages into it. Any "sub-applications" you want to make should just be folders in this single project. [ASP pages don't have color-coding in VS2008 anymore though, which was really annoying.]
如果列出的文件夹结构是所需的Web文件夹结构,那么任何ASP.NET应用程序都可以简单地引用/root/js/whatever.js或../js/whatever.js,它将到达您已经存在的文件夹有根源。这是已经提到的虚拟目录解决方案的替代方案。这是一个相当混乱的解决方案,我在目前的工作中继承了一些项目。
在以前的工作中,我管理了一个混合的Classic ASP / ASP.NET应用程序几年,我通过在根目录下创建一个ASP.NET Web应用程序并将所有ASP页面移入其中来实现。您想要制作的任何“子应用程序”应该只是这个单个项目中的文件夹。 [ASP页面在VS2008中不再有颜色编码了,这真的很烦人。]