Last post Mar 24, 2014 06:58 PM by Luke G
Mar 24, 2014 04:54 PM|Luke G|LINK
In the EnableCorsAttribute. I currently have CORS working on my client and server application.
I think there is a bug in your EnableCorsAttribute constructor.
Steps To Reproduce:
1. I give a comma-delimited list as follows: "http://localhost, http://localhost:60210,
var cors = new EnableCorsAttribute("http://localhost, http://localhost:60210, http://MoreNames", "*", "*");
2. Place debug point after this constructr initialization and notice that origins count is 0.
Expecation: Origins count should be 3. Headers count should be 1. Methods count should be 1.
Actual: Origins count is 0. Headers count is 0. Methods count is 0.
Here is the workaround I am currently using:
var cors = new EnableCorsAttribute("http://localhost", "*", "*");
Mar 24, 2014 04:55 PM|Mikesdotnetting|LINK
You should post possible bugs here: http://aspnetwebstack.codeplex.com/workitem/list/basic
Mar 24, 2014 04:58 PM|Luke G|LINK
Thanks for the link Mike... sending it over now.
Mar 24, 2014 05:03 PM|BrockAllen|LINK
With your exmaple, it shows 3 for me.
Why would headers be 1 with "*"? The semantics are to allow any header requested, which could be more than 1. Also, what should methods be? We have GET, POST, PUT, DELETE, etc.
Mar 24, 2014 06:58 PM|Luke G|LINK
Something changed since this morning, object initializer is working as expected now for parsing the comma-delimited list of origins.
I did notice that "*" doesn't make it into the list until I go in and add it, but it appears to be working with or without it in that list.
BrockAllen via email:
* means “allow any requested” which you won’t know until runtime.
Thanks for the quick reply Brock!