URI Format exception. Unable to determine URI Format

B

Bob

Hi Trying out NetworkCredential class.
The code from the help example fails when you try to do an add to the
Credential cache.
'Invalid URI. The format of the URI can not be determined.'
I don't expect my quoted name, password and domain to pass but I would have
thought that the credential should have added to the cache OK
Thanks.
Bob
NetworkCredential myCred = new NetworkCredential(

"SecurelyStoredUserName", "SecurelyStoredPassword", "SecurelyStoredDomain");

CredentialCache myCache = new CredentialCache();

myCache.Add(new Uri("www.contoso.com"), "Basic", myCred); //FAILS HERE

myCache.Add(new Uri("app.contoso.com"), "Basic", myCred);

WebRequest wr = WebRequest.Create("www.contoso.com");

wr.Credentials = myCache;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top