首页 联系我 返回顶部
MapPath方法,返回与 Web 服务器上的指定虚拟路径相对应的物理文件路径。
先看一张图:
photo
说明:
站点voteengine的主目录为F:\works\P080430_01_VoteEngineV4\DEVELOP\SOURCE\web
public为虚拟目录,指向E:\CaptureImages
public下的note为虚拟目录,指向F:\bin
upload目录不存在
看看下面的代码:
string[] s = new string[] { "", "", "","" };
        s[0] = Server.MapPath("~/upload/");
        s[1] = Server.MapPath("~/public/");
        s[2] = Server.MapPath("~/public/note");
        s[3] = Server.MapPath("~/public/")+"note";
        foreach (string item in s)
        {
            Response.Write("<br />" + item);
        }

请问最终将输出什么?

相关文章

3 Responses

收起评论
  1. 星辉一冷 九月 25 2008 , 00:10 #1
    星辉一冷
    F:\works\P080430_01_VoteEngineV4\DEVELOP\SOURCE\web
    E:\CaptureImages
    F:\bin
    E:\CaptureImages\note

    不知道对不, 没开 VS , 全靠猜的...

    BTW: 终于能发评论了, 之前在 Linux 下还以为是浏览器兼容问题
  2. 幻想曲 九月 25 2008 , 09:49 #2
    幻想曲
    F:\works\P080430_01_VoteEngineV4\DEVELOP\SOURCE\web\upload\
    E:\CaptureImages\
    F:\bin
    E:\CaptureImages\note
  3. 星辉一冷 九月 25 2008 , 15:35 #3
    星辉一冷
    原来如此,受教了
    我以为不存在的话, .NET 会自动找到存在的父级目录呢

Write a comment:



(将显示你的Gravatar图标)  



[b][/b] - [i][/i] - [u][/u]- [quote][/quote]

:-/ ^_^ :d :o :kiss: :) :p :se: [yeah] :( :love: :han: :up: :cry: :zzz: o_o

暂时停止交换链接.

评论提交有问题?