且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从子文件夹访问aspx页面到文件夹aspx页面外的问题

更新时间:2023-09-26 11:18:46

使用相对URL。就这样。检查你的相对路径是否正确。



-SA
Use relative URLs. That's all. Checkup that your relative path is correct.

—SA


你需要使用RelativeURls作为谢尔盖提到并且只是为了获得更多信息,你可以参考下面的例子:



You need to use RelativeURls as Sergey mentioned and only for more information you can refer the following example:

Website
    AdminFolder
        SuperAdminFolder
            Page2.aspx
        Page3.aspx
    UserFolder
        SuperUserFolder
            Page5.aspx
        Page4.aspx
    Page1.aspx







要从Page2访问Page3,您可以使用../Page3.aspx作为路径

要从Page2访问Page1,您可以使用〜/ Page1.aspx作为路径

要从Page2访问Page5,您可以使用../../Users/SuperUser/ Page5.aspx或〜/ Users / SuperUser / Page5.aspx作为路径



基本上您可以使用以下符号来访问您的页面:



。文件的当前物理目录(例如aspx)正在执行

..父目录

〜应用程序根目录的物理路径




To access to Page3 from Page2 you can use "../Page3.aspx" As the path
To access to Page1 from Page2 you can use "~/Page1.aspx" As the path
To access to Page5 from Page2 you can use "../../Users/SuperUser/Page5.aspx" or "~/Users/SuperUser/Page5.aspx" As the path

Basically you can play with following symbols to access your page :

"." the current physical directory of the file (e.g. aspx) being executed
".." The parent directory
"~" The physical path to the root of the application