I need to find the URL of the web application for this site (let's say I have the URL http: // code / sites / java . Given the URL of this site collection, I need the URL of the web application that hosts this family sites. In this case it will be http: // code . Any input will be appreciated.
If you have an SPWeb object, use the Site property . If you have an SPSite object, use the WebApplication property . If you do not have this, create an SPSite object from this URL.
From the SPWebApplication object, use the AlternateUrls property .
From the SPAlternateUrlCollection object , get SPAlternateUrl for the desired zone.
Get the actual URL from the SPAlternateUrl object .
, URL-, , -. , - , , ..
.
:
string path= HttpContext.Current.Request.Url.Authority
URL- -
Source: https://habr.com/ru/post/1719696/More articles:Win32Exception @ ServiceHost.Open () for WCF service - performanceСоздание нулевой гиперссылки - javascriptWhy do we need a call to the inserter function when doing set_union on a set? - c ++What are the communication methods between Silverlight and the server? - silverlightAre .net exes real executables? - .netException handling with WPF and MVVM - exception-handlingHow to remove resource record from resx in C #? - c #Исключения проглатываются в моем приложении WPF. Как заставить приложение рухнуть? - exception-handlingHow to upgrade IIS 6.0 to IIS 7.0 on Windows 2003 - iis-7Error loading WebClient file - c #All Articles