开发者

asp.net ( mvc ) using external folder as resource

开发者 https://www.devze.com 2022-12-10 13:10 出处:网络
i\'ve got a VS2008 asp.net mvc solution with the projects: Common Project_1 Project_2 The common project also contains an \"images\" folder with \"common images\" that should be used by both of th

i've got a VS2008 asp.net mvc solution with the projects:

  • Common
  • Project_1
  • Project_2

The common project also contains an "images" folder with "common images" that should be used by both of the 2 projects...

How would i "link" to these folder from one of the 开发者_如何学运维projects now, when it should be available via a browser ( e.g. via a path like "/Common/images/image1.gif" )?

Do i "reference" it somehow in the project?

I really have no idea how to do this...

Thanks!


One way to do this when deploying is to simply make a virtual directory under Project_1 that points to the Common/Images folder.

In development, you could either copy the folder into the projects or run them under IIS instead of Cassini (built-in VS web server). If you run under IIS, you can create the virtual directories.

Alternatively, if all three projects are setup under IIS, then you could reference them like you did above.

Personally, I just copy the folders into each project during development because I move the images folders outside of the project directory and use virtual directories when deploying anyway. That way I don't have to copy over all of those static resources every time I republish.

0

精彩评论

暂无评论...
验证码 换一张
取 消