将Web表单放置在不同的文件夹中并在asp.net中访问它们 [英] placing web forms in different folders and accessing them in asp.net

查看:88
本文介绍了将Web表单放置在不同的文件夹中并在asp.net中访问它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.
我正在制作一个网站,其中有放置Web表单的各种文件夹.
我没有获得根目录路径的正确方法.另外,有些脚本文件在所有页面上都通用,但是它们无法获取文件位置的正确路径.
例如.调用页面时,该页面位于Info/文件夹的根目录下的User/文件夹中,服务器将尝试在Info文件夹中搜索User文件夹.

因此,我想要一些直接获取根目录路径的方法.尝试过Server.MapPath("),但它返回当前的虚拟路径地址,而不是根路径.

请帮忙!! ..:confused:

Hi.
I am making a website wherein there are various folders in which the web forms are placed.
I am not getting the correct way to get the root directory path. Also, there are some script files which are common to all pages but they cant get the correct path of the file''s location.
eg. When a page is called which is in User/ folder in the root from Info/ folder, the server tries to search for the User folder in the Info folder.

So I want some way to get the root directory path directly. Have tried Server.MapPath("") but it returns the current Virtual path address and not the root path.

Please help!!.. :confused:

推荐答案

尝试过Server.MapPath("~")?


在您变得更加困惑之前,请阅读以下内容文章-有关Asp.net初学者的路径"的一些信息 [评论 [ ^ ]在下面的文章中进行了很好的总结.

我希望这能消除您对路径"的怀疑.

干杯!
安库尔
Before you get more confused, read this article - There is something about "Paths" for Asp.net beginners[^]. There is a comment[^] below the article which summarizes it very well.

I hope that will clear your doubts about the ''paths''.

Cheers!
Ankur


这篇关于将Web表单放置在不同的文件夹中并在asp.net中访问它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆