title: Web Forms Authentication with B2C
body: <p>I'm trying to add authentication using Azure AD B2C to a <strong>web forms</strong> app. Unfortunately, every tutorial I've found is for MVC, except for <a href="http://www.cloudidentity.com/blog/2014/07/24/protecting-an-asp-net-webforms-app-with-openid-connect-and-azure-ad/" rel="nofollow">this web forms tutorial</a>. Using that tutorial, I've added this code to my startup.auth.cs: </p>
  
  <pre><code>public partial class Startup {
  
      // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301883
      public void ConfigureAuth(IAppBuilder app)
      {
          app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
  
          app.UseCookieAuthentication(new CookieAuthenticationOptions());
  
          app.UseOpenIdConnectAuthentication(
              new OpenIdConnectAuthenticationOptions
              {
                  ClientId = "my-client-id",
                  Authority = "https://login.microsoftonline.com/my-tenant"
              });
      }
  }
  </code></pre>
  
  <p>And that is working fine. However, I need to have sign up functionality as well as just sign-in, but I can't figure out how to do it, since everything I've found is for MVC, and I'm not sure how to convert that to what I need. I've tried adding code such as this: </p>
  
  <pre><code>app.UseOpenIdConnectAuthentication(CreateOptionsFromPolicy(_SignUpPolicyId));
  app.UseOpenIdConnectAuthentication(CreateOptionsFromPolicy(_ProfilePolicyId));
  app.UseOpenIdConnectAuthentication(CreateOptionsFromPolicy(_SignInPolicyId));
  </code></pre>
  
  <p>And that creates three more buttons on the login page, but clicking on them just gives a 404 error and no extra information, so I don't know how to make that work, either, or even if I'm headed in the right direction. I've never worked with B2C before, so if anyone has any suggestions/has done this sort of thing for web forms, I'd really appreciate some tips or sample code.</p>