12-28-2010 11:06 AM
string URI = "http://alfrescoserver/alfresco/wcservice/mg/util/login";
string UPN = "username@domain";
HttpWebRequest request = WebRequest.Create(URI) as HttpWebRequest;
WindowsIdentity identity = new WindowsIdentity(UPN);
WindowsImpersonationContext context = null;
try {
context = identity.Impersonate();
request.Credentials = CredentialCache.DefaultNetworkCredentials;
}
catch (Exception e) {
return e.Message + Environment.NewLine + e.StackTrace;
}
finally {
if (context != null) {
context.Undo();
}
}
IWebProxy proxy = new WebProxy(proxyServer, proxyPort);
proxy.Credentials = new NetworkCredential(proxyUsername, proxyPassword);
request.Proxy = proxy;
try {
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) {
StreamReader sr = new StreamReader(response.GetResponseStream());
return sr.ReadToEnd();
}
}
catch (Exception e) {
return (e.Message + Environment.NewLine + e.StackTrace);
}
03-07-2012 03:50 AM
03-08-2012 01:27 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.