title: Configuring Report Server for form authentication
body: <p>I'm using ReportViewer for connecting to report server. Windows authenticaton works well.. but when I used credentials to authenticate to report server I got the error:</p>
  
  <blockquote>
    <p>The request failed with HTTP status 401: Unauthorized.</p>
  </blockquote>
  
  <p>I know I need to configure the report server to accept those credentials, but I don't know actually what it is. Yes I have gone through msdn as well as stack questions too. I'm a complete beginner to SSRS and I want to integrate report server into my web application. what I have done in my application page is:</p>
  
  <pre class="lang-cs prettyprint-override"><code>protected void Page_Load(object sender, EventArgs e)
  {
      //    if (!IsPostBack)
      //    {
              ReportViewer1.ServerReport.ReportServerCredentials =
               new MyReportServerCredentials();
          //    ReportViewer1.ServerReport.Refresh();
          //}
      }
  }
  
  [Serializable]
  public sealed class MyReportServerCredentials : IReportServerCredentials
  {
      public WindowsIdentity ImpersonationUser
      {
          get
          {
              // Use the default Windows user.  Credentials will be
              // provided by the NetworkCredentials property.
              return null;
          }
      }
  
      public ICredentials NetworkCredentials
      {
          get
          {
              // Read the user information from the Web.config file.  
              // By reading the information on demand instead of 
              // storing it, the credentials will not be stored in 
              // session, reducing the vulnerable surface area to the
              // Web.config file, which can be secured with an ACL.
  
              // User name
              string userName =
                  ConfigurationManager.AppSettings
                      ["MyReportViewerUser"];
  
              if (string.IsNullOrEmpty(userName))
                  throw new Exception(
                      "Missing user name from web.config file");
  
              // Password
              string password =
                  ConfigurationManager.AppSettings
                      ["MyReportViewerPassword"];
  
              if (string.IsNullOrEmpty(password))
                  throw new Exception(
                      "Missing password from web.config file");
  
              // Domain
              string domain =
                  ConfigurationManager.AppSettings
                      ["MyReportViewerDomain"];
  
              if (string.IsNullOrEmpty(domain))
                  throw new Exception(
                      "Missing domain from web.config file");
  
              return new NetworkCredential(userName, password, domain);
          }
      }
  
      public bool GetFormsCredentials(out Cookie authCookie,
                  out string userName, out string password,
                  out string authority)
      {
          // not use FormsCredentials unless you have implements a custom autentication.
          authCookie = null;
          userName = null;
          password = null;
          authority = null;
  
          // Not using form credentials
          return false;
      }
  }
  </code></pre>
  
  <p>And in the <code>RsReportServer.config</code> file I modified and replaced the <code>&lt;authentication&gt;</code> node with:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Authentication&gt;
        &lt;AuthenticationTypes&gt;
               &lt;Custom /&gt;
        &lt;/AuthenticationTypes&gt;
        &lt;EnableAuthPersistence&gt;true&lt;/EnableAuthPersistence&gt;
  &lt;/Authentication&gt;
  </code></pre>
  
  <p>And in <code>web.config</code> file of reportserver I changed authentication to forms and impersonate to false, and I did the same in <code>web.config</code> file of reportmanager .</p>
  
  <p>Anything missing. or am I right?</p>
  
  <p>I also guess I need to do something with CustomSecurity Extension term?</p>