I've been handed alegacy (Classic ASP), red headed step child who has been beaten, shot and otherwise maime开发者_如何学JAVAd by a number of people before my time, application and for the life of me I can't figure out how it's actually working on production (I even got a copy from production just in case the files weren't up to date in source control).
I have code that does the following
tmpDefaultXSLFile="xsl/SomeValue"
...
objXsl.load(Server.MapPath(tmpDefaultXSLFile & ".xsl"))
However, Server.MapPath seems not to map the file to the expected location (i.e."\asp_file_directory\xsl\SomeValue.xsl" and the modification required is to the xsl file.
Is there ANY way that the system could be fooled into have Server.MapPath map somewhere else?
Looks like virtual directory on IIS is causing this. Check the URL and compare it to the directory structure within IIS including the virtual.
server.mappath(Path) specifies the relative or virtual path to map to a physical directory.
If Path starts with either a forward (/) or backward slash (\), the MapPath method returns a path as if Path is a full virtual path.
If Path doesn't start with a slash, the MapPath method returns a path relative to the directory of the .asp file being processed.
精彩评论