View Single Post
  #1 (permalink)  
Old August 12th, 2015, 07:09 PM
skupena skupena is offline
Registered User
Points: 19, Level: 1
Points: 19, Level: 1 Points: 19, Level: 1 Points: 19, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2015
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 13 - HAL Browser Update

Hi,
I typed and ran the REST API example in chapter 13 using the current version of the HAL browser. It seems that this version sets the useCredentials property to true when making its AJAX requests. So, to make the example work, I had to configure CORS on the Accounts API to support credentials, and then set the allowed origins to be the URL of the EntryPoint API (because the CORS specification won't allow a wildcard in this scenario).

To make the example work with the latest HAL browser, go to the following line of code in the Register method of WebApiConfig.cs in the Accounts API project:

var cors = new EnableCorsAttribute("*", "*", "*");

and replace this line with the following two lines of code:

var cors = new EnableCorsAttribute("http://localhost:4100", "*", "*");
cors.SupportsCredentials = true;

This should produce the same results as the code sample in the book.

Thank you very much,

Andy
Reply With Quote