I reveiced the below details after following the above authentication mechanism :
//code snippet start
var webClient = new WebClient();
webClient.Credentials = CredentialCache.DefaultNetworkCredentials;
var adminKey = String.Format("{0}:{1}","cfg.adminkey", cfg.accountkey);
// cfg object has admin key and account key -> reading from configuration file
var adminKeyBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(adminKey));
webClient.Headers.Add("Rest-User-Token", adminKeyBase64);
var requestUrl = "http://blrkct0123pc/telligententerprise/api.ashx/v2/users.xml";
try
{
string xml = string.Empty;
try
{
xml = webClient.DownloadString(requestUrl);
LogEngine.WriteLogMessage(" Call REST URI Result = " + xml, eventlogpath);
}
catch (WebException ex)
{
using (var reader = new StreamReader(ex.Response.GetResponseStream()))
{
var responsexml = reader.ReadToEnd();
//Console.WriteLine(responsexml);
LogEngine.WriteLogMessage("** Catch Exception : " + responsexml.ToString() + "while calling URI: " + requestUrl, eventlogpath);
}
}
// code snippet ends
Encountered the following error deatils in webexception
Most likely causes:
•The username supplied to IIS is invalid.
•The password supplied to IIS was not typed correctly.
•Incorrect credentials were cached by the browser.
•IIS could not verify the identity of the username and password provided.
•The resource is configured for Anonymous authentication, but the configured anonymous account either has an invalid password or was disabled.
•The server is configured to deny login privileges to the authenticating user or the group in which the user is a member.
•Invalid Kerberos configuration may be the cause if all of the following are true:
◦Integrated authentication was used.
◦the application pool identity is a custom account.
◦the server is a member of a domain.
Things you can try:
•Verify that the username and password are correct, and are not cached by the browser.
•Use a different username and password.
•If you are using a custom anonymous account, verify that the password has not expired.
•Verify that the authenticating user or the user's group, has not been denied login access to the server.
•Verify that the account was not locked out due to numerous failed login attempts.
•If you are using authentication and the server is a member of a domain, verify that you have configured the application pool identity using the utility SETSPN.exe, or changed the configuration so that NTLM is the favored authentication type.
•Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
PS: Same application code is working with development setup ( having single domain )but it not woring in cross domain set up.
Thanks and regards,
Niranjan