NavigateUrl='<%#DataBinder.Eval(Container.DataItem,"mn_url")%>' 其中“mn_url”是从数据库中读取的相对地址。
当前所在页面是 http://localhost/internal_cc/Reports/Report_List_Submenu.aspx ,链接进去的地址是“http://localhost/internal_cc/Reports”+ 相对地址。 现在我想获得“http://localhost/internal_cc/”+相对地址,就是当前页面的上级站点地址 + 相对地址。
怎么做呢。

解决方案 »

  1.   

    Request.ApplicationPath
        结果:/itnews    Request.CurrentExecutionFilePath:
        结果:itnews/default.aspx    Request.FilePath:
        结果:/itnews/default.aspx    Request.Path:
        结果:/itnews/default.aspx    Request.PhysicalApplicationPath:
        结果:d:\wwwroot\itnews\    Request.PhysicalPath:
        结果:d:\wwwroot\itnews\default.aspx    Request.RawUrl:
        结果:/itnews/default.aspx    Request.Url.AbsolutePath:
        结果:/itnews/default.aspx    Request.Url.AbsoluteUri:
        结果:http://weste.net/itnews/default.aspx    Request.Url.Host:
        结果:weste.net    Request.Url.LocalPath:
        结果:/itnews/default.aspx自己结合使用吧
      

  2.   

     回到上级
      response.redirect("../registerok.aspx")    回到上级另外一个目录下  
      response.redirect("../login/registerok.aspx")  
     
      转到本目录下级目录中  
      response.redirect("下级目录名/registerok.aspx")
      

  3.   

    你这样写:
    NavigateUrl='<%"../"+#DataBinder.Eval(Container.DataItem,"mn_url")%>'
      

  4.   


    NavigateUrl='<%# "../"+DataBinder.Eval(Container.DataItem,"mn_url").ToString()%>'