[Umbraco] How to get media URL

Here is one way to do:

string s = string.Empty;
System.Xml.XPath.XPathNavigator n = umbraco.library.GetMedia(m.Id, false).Current;
System.Xml.XPath.XPathNavigator d = n.SelectSingleNode("/node/data[@alias='umbracoFile']");
s=d.InnerXml; // Here is the path


.NET 4.0 Serializing IDictionary

Yes, now we can serializing the object which contain or implement of IDictionay in .NET 4.0.

The different part of code is change to using System.Xaml namespace and the code is more simple, for instance:

using (StreamWriter stream = newStreamWriter("C:\\data.xml")) {

Now the I have to reconsider the power of the web service…


現在我們可以在.NET4.0 的程式碼中Serializing(序列化)含有IDictionary或是繼承自他的物件.

差異的地方是我們必須引用System.Xaml, 新的序列化服務的寫法也變簡單了, 請參考下面程式碼:

using (StreamWriter stream = newStreamWriter("C:\\data.xml")) {

嘖嘖嘖..我現在要好好想想web service的威力了….


System.Net.WebException: The request failed with HTTP status 503: Service Unavailable


  1. ASP.NET application (Web from or call another ASP.NET web service) in IIS6
  2. Complicated network environment
  3. Several web front ends
  4. Every web service call return 503…

Maybe you can try to setup the Internet Explorer proxy settings to bypass every web front end, and also downgrade the IIS from Kerberos to NTLM, and try it again.

Internet Explorer configuration :

  1. Tools –> Internet Options
  2. Connections Tab –> LAN Settings
  3. “Advanced” button inside “Proxy Server” group
  4. Add the web front ends’ domain name into the “Exceptions”

How to downgrade from Kerberos to NTLM:

  1. Open command prompt
  2. Change directory to “C:\Inetpub\Adminscripts
  3. Input:
    cscript adsutil.vbs set w3svc/WebSite/root/NTAuthenticationProviders "NTLM"
  4. About WebSite, it is web site id, you can find it by fowllowing steps:
    1. Open Internet Information Services (IIS) Manager
    2. Click “Web Sites”, and you can found the value in the Identifier column
  5. Input as following command then you can rollback to Kerberos:
    cscript adsutil.vbs set w3svc/WebSite/root/NTAuthenticationProviders "Negotiate,NTLM"



  1. ASP.NET 應用程式呼叫ASP.NET web service, IIS6
  2. 網路環境有點複雜, 而且離我超遠
  3. 很多台web front end
  4. 隨便Call web service都回你503

我後來是這樣解的, 先把所有的web front end server都列入直接連線的部分, 接下來再把所有的web front end的IIS通通設定成NTLM. 先求可以通, 這樣回到Kerberos才有機會跟網管那邊確認問題.

怎麼設定bypass proxy server

  1. 打開IE, 工具->網際網路選項
  2. “連線” 那個頁籤, 選區域網路設定
  3. 按那個進階的按鈕
  4. 在那個例外裡面輸入web front end server的domain name


  1. 打開”命令提示字元”
  2. 將路徑轉換到 “C:\Inetpub\Adminscripts
  3. 輸入:
    cscript adsutil.vbs set w3svc/WebSite/root/NTAuthenticationProviders "NTLM"
  4. 那個WebSite就是站台的ID, 要找的話打開IIS管理工具, 然後點站台, 右邊就會有欄位顯示出來了
  5. 要倒回去Kerberos, 輸入下列命令即可:
    cscript adsutil.vbs set w3svc/WebSite/root/NTAuthenticationProviders "Negotiate,NTLM"