如何在母版页中访问.aspx页面表单文件夹? [英] How to access .aspx page form folder in master page?

查看:77
本文介绍了如何在母版页中访问.aspx页面表单文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)我有一个母版页,其中两个按钮一个是登录,另一个是联系。

2)signin.aspx页面保存在signin文件夹中,contact.aspx处于打开状态(不是任何文件夹)

3)当我点击signin.aspx它的工作(http:// localhost:60765 / signin / signin.aspx)但当我点击联系时(http:// localhost: 60765 / signin / contact.aspx)它也在登录文件夹中搜索



并显示错误资源不喜欢



我尝试了什么:



  <   pre  >  <   a     runat   = 服务器      hre f   =  / signin / signin.aspx   > 登录<   / a  >  



其他联系方式



< a runat =serverhref =contact.aspx> contact< / a> 

解决方案

您正在使用页面的相对路径。您应该使用完整路径。

当引用ASPX页面中的页面/图像/脚本时,您应该包括根目录中的完整路径。

让我们说你有以下结构;

根目录中的Default.aspx

SiteMaster.Master在名为Master的文件夹中

Signin.aspx在名为Singin的文件夹中/>
Contact.aspx在名为Contact的文件夹中

根文件夹中的About.aspx



这些中的每一个的完整路径文件将是;

~ / Default.aspx

~ / Master / Sitemaster.Master

~ / Singin / Singin.aspx
~ /联系方式/ Contact.aspx

~ / About.aspx

〜字符表示您网站的根目录



你真的不应该使用相对路径

参考: ASP.NET Web项目路径 [ ^ ]

1)i have a master page where two button one is signin and another one is contact.
2) signin.aspx page in save in signin folder and contact.aspx is in open (not any folder)
3) when i click for signin.aspx its work (http://localhost:60765/signin/signin.aspx) but when i click for contact (http://localhost:60765/signin/contact.aspx) it's also search in signin folder

and show error "resource not fond"

What I have tried:

<pre> <a runat="server"  href="/signin/signin.aspx" >Sign in</a>


other for contact

<a runat="server"  href="contact.aspx" >contact</a>

解决方案

You are using a relative path to the page. You should be using a full path.
When referencing pages/images/scripts within a ASPX page you should include the full path from the root directory.
Lets say you have the following structure;
Default.aspx in root directory
SiteMaster.Master in folder named Master
Signin.aspx in folder named Singin
Contact.aspx in folder named Contact
About.aspx in root folder

The full path to each of these files would be;
~/Default.aspx
~/Master/Sitemaster.Master
~/Singin/Singin.aspx
~/Contact/Contact.aspx
~/About.aspx
The "~" character indicates the root of you website

You really shouldn't use relative paths
Refer: ASP.NET Web Project Paths[^]


这篇关于如何在母版页中访问.aspx页面表单文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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