开发者

Configure an IIS Site to default to non-root directory?

Say I have a directory structure like so:

/public

/public/company

/public/globals

/public/globals/images

/public/jobs

/public/jobs/it

... etc.

What I would like to do is to be able to configure an IIS Site to load from /public/company when visiting the domain root. I know I can change the site to /public/company, but if I do that, I can't seem to reference the /public/globals directory to obtain images, videos,开发者_如何学C and other items used across the site.

The other problem is accessing /public/jobs with a domain/jobs url... although I suppose virtual directories can help there, but then I would assume that I would still run into problems trying to access /public/globals for images and other things.

Any ideas? Am I not doing this right? I'm used to using Apache... obviously a very different environment...


Create a Default.aspx page in the root, and on that page, run this:

Response.Redirect("~/public/company/destination.aspx");


I seemed to have found the answer. I set the default path of the Site to /public/company, and created a Virtual Directory called "globals" that points to /public/globals. Now I can reference images via the Virtual Directory like so:

<img src="/globals/images/awesome.png" />

I suppose I just need to create virtual directories for everything under the sun for the rest of the site then.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜