开发者

Server.MapPath not returning expected path

开发者 https://www.devze.com 2023-02-11 19:51 出处:网络
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'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.

0

精彩评论

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