Can't Authenticate to SiteMinder protected resource that requires NTLM authentication

  • Thread starter Thread starter JoeMITRE
  • Start date Start date
J

JoeMITRE

Guest
Url is a location in the same domain, but not the same machine.

I do not have admin access to either SiteMinder or the the target machine.



No matter what I've tried, and I've tried a lot, I cannot get past the first Request.GetResponse() call. Because of this I cannot get the header, I cannot get the cookies, I cannot get the SMAgentID.



This line: Response = (HttpWebResponse)Request.GetResponse();

throws this error: "The remote server returned an error: (401) Unauthorized." at System.Net.HttpWebRequest.GetResponse(), in Main()





------------------------ Code Snippet --------------------------------------------


using

System;


using

System.Text;


using

System.Net;


using

System.IO;

.

.

.

.

String username = "username";

String password = "password";

String domain = "domain";

String Url = http://intranet/blah;

CredentialCache MyCredentialCache = new CredentialCache();

MyCredentialCache.Add(new Uri(Url), "NTLM", new NetworkCredential(username, password, domain));

HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(Url);

Request.Credentials = MyCredentialCache;

Request.PreAuthenticate = false;

Request.AllowAutoRedirect = true;

Request.UnsafeAuthenticatedConnectionSharing = true;

Request.Method = "HEAD";

Request.Timeout = 100000;

Console.WriteLine("Get response HEAD");

HttpWebResponse Response;

Response = (HttpWebResponse)Request.GetResponse();

Response.Close();

Console.WriteLine("Got response HEAD");

.

.

.

.

------------------------ End Code Snippet --------------------------------------------

Continue reading...
 
Back
Top