Enable CROS for azure


No need to add proxy in We.config

<defaultProxy useDefaultCredentials=”true”>
<proxy bypassonlocal=”True” usesystemdefault=”True” />

Add following code to enable Cors in WebApiConfig.cs

public static class WebApiConfig
public static void Register(HttpConfiguration config)
// Web API configuration and services
// New code for enable cross-origin resource sharing (CORS)

Add attribute EnableCors in Controller.cs

[EnableCors(origins: “http://ashuthinkswebsite.azurewebsites.net&#8221;, headers: “*”, methods: “*”)]
public class ContactsController : ApiController

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s