IIS 6 Root vs Application? ResolveUrl ()?

IIS 6 ASP.NET 3.5 (C # .NET)

We are having a problem where the same set of files behaves differently depending on whether it is the IIS root site and the application on the IIS website. URLs created using ResolveUrl () are different - i.e.:

<a href="<%=ResolveUrl("~/contact.aspx") %>">Contact Us</a> 

Both use the same files. The first example is his own website, the second is a virtual directory created in an application (called DSC). Both of them also use the same application pool and configuration, document and security settings (I made sure that all the settings in IIS were the same between them). A.

All that has been investigated indicates that ResolveUrl () refers to the IIS application that hosts the web page. I also read several places, even if the information is not complete in IIS (in this case, it is), the root site is considered an application. Therefore, he must create the corresponding web address, but is not.

Any help finding additional research to determine which settings / settings are not set properly or why ResolveUrl () is not programmatic.

+4
source share
1 answer

Note this: From Relative Path to Absolute Path in ASP.NET without using Tilda ~ . You can consider replacing the use of tildes (~) with HttpRuntime.AppDomainAppVirtualPath . If the web application is located in the root folder of the server, AppDomainAppVirtualPath returns only "/". If the web application is in the root folder, it returns the virtual path to the folder without the "/" at the end ( source ).

+2
source

Source: https://habr.com/ru/post/1342907/


All Articles