C# 授权标题Silverlight网络客户端

C# 授权标题Silverlight网络客户端,c#,web-services,silverlight,C#,Web Services,Silverlight,我使用WebClient从另一个应用程序调用Web服务,它实际上可以工作,但对于某些服务,我需要发送授权头。 我尝试过很多类似的事情: string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(userName + ":" + password)); req.Headers[HttpRequestHeader.Authorization] = string.Format("Basic {0}", credentia

我使用WebClient从另一个应用程序调用Web服务,它实际上可以工作,但对于某些服务,我需要发送授权头。 我尝试过很多类似的事情:

 string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(userName + ":" + password));
 req.Headers[HttpRequestHeader.Authorization] = string.Format("Basic {0}", credentials);
但是Silverlight没有实现Encoding.ASCII,而且它不工作

我也试过:

WebClient wc=new WebClient();
wc.Credentials=new NetworkCredentials("user","pass");
它不起作用了


我在这里找人帮忙

您应该能够使用等效的UTF8类而不是ASCII类。但是,你能不能提供更多的细节,说明出了什么问题?你有例外吗?您是否尝试过使用Fiddler进行服务器端WCF跟踪或客户端HTTP跟踪?