ASP.Net 项目中的虚拟目录

发布于 2024-10-08 22:14:20 字数 584 浏览 0 评论 0原文

我的团队在企业环境中工作,构建多个 ASP.Net 应用程序(VS2008 中的 v3.5 和 VB.Net - 请不要火焰!)以标准外观和样式。感觉。

我不想将相同的图像、样式表等复制到每个新项目中并必须维护大量内容,而是更愿意在每个项目中使用虚拟目录之类的东西,该目录引用单个源(可能是某个项目上的 URL)。外部 IIS 盒)

我可以在项目/项目模板中做些什么来提供此功能,而无需在开发人员 PC 上以及开发、测试和生产 IIS 盒上的每个应用程序上配置虚拟目录吗?我也不想为每个图像和样式表提供一个完全限定的 URL 到生产框。

例如,不必编写:

<img src="http://ProductionServer/CorpStandards/logo.png" />

我希望开发人员能够执行以下操作:

<img src="CorpStandards/logo.png" />

其中 CorpStandards 是项目内的虚拟目录,而不是包含所有标准副本的物理文件夹文件。

有什么想法吗?

My team are working in a corporate environment, building multiple ASP.Net apps (v3.5 in VS2008 and VB.Net - no flames please!) to a standard look & feel.

Rather than copy the same images, stylesheets, etc. into every new project and have to maintain the lot, I'd prefer to make use of something like a virtual directory WITHIN each project that refers to a single source (probably a URL on an external IIS box)

Is there anything I can do WITHIN the project / project template to provide this without having to configure Virtual Directories on developer PCs and each and every application on the dev, test and production IIS boxes? I'd also rather not have to provide a fully-qualified URL to the production box for every image and stylesheet.

For example, rather than having to write:

<img src="http://ProductionServer/CorpStandards/logo.png" />

I'd prefer the devs to be able to do the following:

<img src="CorpStandards/logo.png" />

where CorpStandards is a virtual directory within the project rather than a physical folder containing a copy of all the files.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独难免 2024-10-15 22:14:20

您可以拥有您想要的内容,但不必在每个网站中设置新的虚拟目录。

这是您需要做的(我喜欢的方式),打开 IIS 管理器。

然后在 Sites 下的 Connections 中选择网站并右键单击它,选择
从上下文菜单中添加虚拟目录...。在打开的对话框中输入您选择的别名,例如“GlobalImages”,然后浏览您想要的文件夹的物理路径选择它并单击“确定”。您将可以在该网站的相对网址中使用它。

您需要对每个网站重复相同的步骤。

祝你好运..

You can have what you wish but not without having to setup a new virtual directory in Each Website.

Here's what you need to do (way i prefer), Open IIS manager.

Then in Connections under Sites Select The Website and RightClick on it, Select
Add Virtual Directory... from the Context menu. in The dialogue box that opens Enter the Alias name of your choice like "GlobalImages" and Browse the physical path of the Folder you want to want Select it and Click OK. You will have it available for relative url in that website.

You need to repeat the same step for each website.

Good luck..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文