If your enterprise has a proxy server for all servers with credentials, your SharePoint servers may not be able to connect to Internet. You would probably see errors on RSS Viewer webparts trying to read feeds from Internet.

You need to write some code and deploy a DLL and modify web.config to solve this issue. Here is how to do it:

1)      Write a C# class library using following code:

using System;

using System.Collections.Generic;

using System.Text;

using System.Net;

 

namespace XXXSharePoint

{

    public class XXXWebProxy : IWebProxy

    {

        #region IWebProxy Members

 

        public ICredentials Credentials

        {

            get

            {

                return new NetworkCredential(@"account",@"password");

            }

            set

            {

            }

        }

 

        public Uri GetProxy(Uri destination)

        {

            return new Uri("http://proxy:port");

        }

 

        public bool IsBypassed(Uri host)

        {

            return false;

        }

 

        #endregion

    }

}
http://proxy:port  is your proxy server’s URL and port, you also need to replace "account","password" with your proxy’s username and password.

2)      Compile and deploy the class library (DLL) to SharePoint all servers

3)      Add following lines to your SharePoint web application’s web.config, you can use a feature receiver to do the addition.

<defaultProxy enabled="true" useDefaultCredentials="false">

  <module type = "YourNameSpace.XXXWebProxy, YourAssembly, …" />

</defaultProxy>

 

Now do an iisreset and you should be able to access Internet using the proxy from your servers.

 

Of cause it is not the best practice to hard code your credentials in code. You can leverage ASP.NET's ability of encrypt and decrypt configuration http://msdn.microsoft.com/en-us/library/zhhddkxy.aspx to protect your secrets. You can even create your own encryption solution to achieve this but that’s another topic on its own.

 

Zewei Song, Ph.D.

MCPD, MCTS: .NET 3.5, MOSS AppDev, Configuration

Enterprise Services, Microsoft Corporation