SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have wss 3.0 with auth type Integrated Windows Authentication/Kerberos. I want to make custom login form. I developed below codes. After executed I got error: The remote server returned an error: (401) Unauthorized. Why?

string url = @"";

    WebRequest request = WebRequest.Create(url);

    request.Credentials = GetCredential();
    request.UseDefaultCredentials = false;
    request.PreAuthenticate = true;
    request.Method = "POST";
    request.ContentLength = 0;
    request.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f");

private CredentialCache GetCredential()
    string url = @"";
    CredentialCache credentialCache = new CredentialCache();
    string authType = "IntegratedWindowsAuthentication";

    credentialCache.Add(new System.Uri(url), authType, new NetworkCredential("jacek", "pass123", "domainName"));
    return credentialCache;
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.