I added a website named TestApplication in IIS (physical path: C:\Websites\TestApplication\) and a virtual directory named igres (C:\WebdataGrid\ig_res\) under the website.
There are css files under the ig_res folder that I can navigate to by browsing the igres folder under the TestApplication website in IIS (http://localhost:800/igres/Default/ig_calendar.css).
However when I try to go directly to http://localhost:800/ig_res/Default/g_calendar.css the
physical path is pointing to: C:\Websites\TestApplication\ig_res\Default\ig_shared.css instead of C:\WebdataGrid\ig_res\.
The TestApplication has a Test.aspx file. When I go to the aspx page the stylesheets defined in the CSS files don't show up. And I get a 404 error for the .css files.
What could be the issue?
Thanks!
How are you referencing the files from your test.aspx? The physical path will have nothing to do with it because it all has to do with how the web server sees things.
The only thing I can see is your example has of what works has /igres/Default/ig_calendar.css and the link you say isn't working has /ig_res/Default/ig_shared.css. The igres in non-working has an underscore in it. If you get the path wrong, you're not going
to hit the virtual directory at all and it will attempt to look at the physical path and generate a 404. So, the issue here is your path is wrong which is why it is attempting to look at the physical path and coming up incorrect as something in your path isn't
matching the virtual directory.
When you start getting 404 errors for things like this, one thing to try is going into the IIS manager, browsing to the folder that you are trying to target, and hit the Browse icon under Actions | Manage Folder on the right hand side of the management console.
This will bring up IE to view the directory, which generates a server error because you cna't view the files but at least you can get the root path correct.
I got it working. The alias name of the virtual directory has to be the same of the folder name that it's pointing to in the physical path. Initially, I had the name of the alias as igres, but the physical path was pointing to a folder by the name
of ig_res. I deleted the virtual directory and recreated it with an alias as ig_res.
沒有留言:
張貼留言