Azure B2C Unified sign up with Page UI customization

2016, Apr 13    

When crafting a new Unified sign-up or sign-in page policy in the Azure Portal I managed to get this error

#error=server_error&error_description=AADB2C90001: The server hosting resource '' is not enabled for CORS requests. Ensure that the 'Access-Control-Allow-Origin' header has been configured.<br /> Correlation ID: 613d1479-d146-4b89-abb8-3264730f5991<br /> Timestamp: 2016-04-13 18:33:30Z<br />

Of course, i’d been a bit quick off the mark and not yet changed my website to accept Cross Origin Requests.

Here’s what you’ll need to add to your unified Sign In page to fix the error
<br /> Response.AppendHeader("Access-Control-Allow-Origin", "");<br />

Code wise, here’s how the Controller Action and View look;

public ActionResult SignInOrSignUp()
      Response.AppendHeader("Access-Control-Allow-Origin", "");
      return View();
    ViewBag.Title = "SignInOrSignUp";
    Layout = "~/Views/Shared/_Layout.cshtml";


<p>This is our own experience for sign in/up</p>

<div id="api"></div>