VS.NET 2010 (and above) Users Click Here   

HOMECONTACT PRODUCTS DOWNLOADS PURCHASE TESTIMONIALS FORUMS COMPANY CONTACT
Home
Products
Downloads
Purchase
Licensing
Licensing FAQ
Software Updates
Support Forums
Testimonials
Feature Requests
Guarantee
About Us
Contact Us
Hosting Companies
Privacy Policy
   
Shopping Cart


aspNetEmail forum



[ Reply to Post ] [ Back To Forum ]
From: "Kevin" <glpkevin@...>
Date: 6/3/2014 8:37:00 AM
Subject: RE: System.Net.WebException: The remote server returned an error: (401)
Thanks for your quick response.
I was actually able to get a reply using this snippet:

Uri targetUri = new Uri(url);
HttpWebRequest util = WebRequest.Create(url) as HttpWebRequest;

Security security = new Security();

byte[] encryptedByteInternal = security.ConvertStringToByte(encryptedPassword);

string password = security.Decrypt(encryptedByteInternal, Security.KeyToUse.externalKey);

//// util.Credentials = CredentialCache.DefaultCredentials;
CredentialCache cc = new CredentialCache();
cc.Add(targetUri, "NTLM", new NetworkCredential(username, password, domain));
util.Credentials = cc;
HttpWebResponse response = util.GetResponse() as HttpWebResponse;

string result = string.Empty;
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
result = reader.ReadToEnd();
}

return result;

Do you know what may have broken my original code?

Thanks.

 

 

 



Thread View

Subject By Date
System.Net.WebException: The remote server returned an error: (401) Kevin 6/3/2014
   RE: System.Net.WebException: The remote server returned an error: (401) dave wanta 6/3/2014
     RE: System.Net.WebException: The remote server returned an error: (401) [ you are here ] Kevin 6/3/2014
     RE: System.Net.WebException: The remote server returned an error: (401) Kevin 6/3/2014
       RE: System.Net.WebException: The remote server returned an error: (401) dave wanta 6/3/2014
         RE: System.Net.WebException: The remote server returned an error: (401) Kevin 6/3/2014
           RE: System.Net.WebException: The remote server returned an error: (401) dave wanta 6/4/2014

 

 

Testimonial

The client tested it for us and it works fine on their Lotus environment. Thank you for your quick response. Your support rocks!!! "

A. O. | Datacert

Read more testimonials
ListNanny aspNetDNS aspNetEmail aspNetPOP3 aspNetMX IPMuncher aspNetMIME aspNetPING aspNetTraceRoute aspNetIMAP aspNetMHT