Zippy
Zippy

Reputation: 495

Setting up application and resource folders in sub virtual application

I am looking to use the below asp.net 4.0 web application structure but not quite sure how to achieve my result as explained below. What configuration will be needed to handle path issues for referencing both. For example ~/css/style.css needs to dig into the WEBSITE. I know I will have to create a helper for RESOURCES -- WebResourcePath("images/image1.jpg") returns full path if that works in a separate virtual directory?

Default Web Site
    >SAR-GROUPS
        SARGROUPS_WEBSITE
        SARGROUPS_RESOURCES

All website files like aspx, js, css, etc. normal web files go in the WEBSITE folder. The RESOURCES folder will contain other files like pdfs, xml, txt, images, and files . These files will not need to be uploaded or updated during deployments and can remain untouched. When I deploy the WEBSITE I only need to delete the WEBSITE folder and copy the new precompiled folder in SAR-GROUPS again. I have to deploy like this as it is automated deployment from scrips that run so this is an xcopy deployment.

Does anyone have good practices or a working setup to achieve this. I am not looking at alternate methods unless it cannot be done or the other way is much better for auto builds.

Thanks

Upvotes: 3

Views: 181

Answers (1)

matt_lethargic
matt_lethargic

Reputation: 2796

If the files in the SARGROUPS_WEBSITE directory need to reference resources in the SARGROUPS_RESOURCES directory then why not just make the SARGROUPS_RESOURCES virtual directory inside the SARGROUPS_WEBSITE directory? This way you can point the SARGROUPS_RESOURCES virtual directory at a physical location on the disk and delete the contents of SARGROUPS_WEBSITE without touching the resources.

So structure would be

Default Web Site
    >SAR-GROUPS
        SARGROUPS_WEBSITE
            SARGROUPS_RESOURCES

But the physical structure could be anything

You can then reference them like

~/SARGROUPS_RESOURCES/css/style.css

*untested

EDIT

You've totally not understood my answer and/or virtual folders.

Physical structure example:

D:\Inetpub\WEBSITE
D:\Inetpub\RESOURCES

IIS structure:

IIS Root -> Site (that is a website and points to D:\Inetpub\WEBSITE)
IIS Root -> Site > Resources (that is a virtual directory and points to D:\Inetpub\RESOURCES)

Upvotes: 2

Related Questions