[英]Urls on nested web application under IIS Web Site
I have website running under IIS 7.5. 我的网站在IIS 7.5下运行。 It has child web application 'WebA'.
它具有子Web应用程序“ WebA”。 Path to that site is 'localhost/weba' WebA has some pages with anchors on it, anchor urls are like '/UserDetails.aspx'.
该站点的路径是'localhost / weba'WebA上有一些带有锚的页面,锚URL类似于'/UserDetails.aspx'。 When I click on this anchors, browser redirects me to localhost/userDetails.aspx instead of localhost/weba/userdetails.aspx.
当我单击该锚点时,浏览器将我重定向到localhost / userDetails.aspx而不是localhost / weba / userdetails.aspx。
I have working example under IIS 6, but have no idea what option should be set to make it work under IIS 7.5 我有IIS 6下的工作示例,但不知道应该设置什么选项以使其在IIS 7.5下工作
You should try 你应该试试
<asp:HyperLink NavigateUrl="~/UserDetails.aspx" runat="server">My link</asp:HyperLink>
and it should redirect to localhost/weba/userdetails.aspx. 它应该重定向到localhost / weba / userdetails.aspx。
In Javascript you can use the value of 在Javascript中,您可以使用的值
var myUrl = '<%= System.Web.VirtualPathUtility.ToAbsolute("~/UserDetails.aspx") %>';
Basically you need to add a '~/' to the beginning of your path because it's the application relative path and not the path of the root domain. 基本上,您需要在路径的开头添加“〜/”,因为它是应用程序相对路径,而不是根域的路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.