简体   繁体   English

在IIS网站上浏览嵌套的Web应用程序

[英]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.

相关问题 网站作为IIS 7中的应用程序 - web site as application in IIS 7 在IIS默认网站下创建asp.net MVC Web应用程序或将其创建为新网站之间的区别 - Difference between creating my asp.net MVC web application ,under the IIS Default web site, or create it as a new web site 在将IIS“嵌套”应用程序部署到主网站后,第二个ASP.NET Web应用程序挂起 - a second ASP.NET web app hangs after deployed as IIS 'nested' Application onto primary web site 当ASP.net MVC应用程序添加到IIS中的现有网站时,相对URL断开 - Relative URLs broken when ASP.net MVC application added to existing web site in IIS iis7下的Web应用程序的许多appdomains - Many appdomains for a web application in under iis7 ASP.NET CORE 3.0 应用到默认网站/MySite 下的 IIS 无法正常工作 - ASP.NET CORE 3.0 application to IIS under Default Web Site/MySite does not work properly TFS 2017版本定义。 WinRM - IIS Web App管理任务。 在“默认网站”下创建应用程序 - TFS 2017 Release definition. WinRM - IIS Web App Management task. Create application under “Default web site” IIS 7网站复制 - IIS 7 replication of web site IIS中的网站部署 - Web Site deployment in IIS Web API嵌套资源在IIS8下失败 - Web API nested resource failing under IIS8
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM