Skip to content

Instantly share code, notes, and snippets.

@mbmccormick
Created March 5, 2012 14:48
Show Gist options
  • Select an option

  • Save mbmccormick/1978607 to your computer and use it in GitHub Desktop.

Select an option

Save mbmccormick/1978607 to your computer and use it in GitHub Desktop.
Enable cross-domain resource sharing on a WCF web service, this is pretty dirty.
[WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/common/helloWorld?name={name}")]
public string HelloWorld(string name)
{
WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*");
return "Hello World! Your name is " + name + ".";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment