static MvcCorsConfiguration()
 {
     Configuration = new MvcCorsConfiguration()
     {
         ResourceNameIncludesActionName = true
     };
 }
 static MvcCorsConfiguration()
 {
     Configuration = new MvcCorsConfiguration()
     {
         ResourceNameIncludesActionName = true
     };
 }
        private void RegisterCors(MvcCorsConfiguration corsConfig)
        {
            corsConfig
                .ForResources("Values1.GetData")
                .ForOrigins("http://localhost")
                .AllowMethods("GET", "POST");

            corsConfig
                .ForResources("Values2.GetData")
                .ForOrigins("http://localhost")
                .AllowMethods("GET", "POST")
                .AllowCookies()
                .AllowResponseHeaders("Foo");

            corsConfig
                .ForResources("Values3.GetData")
                .ForOrigins("http://localhost")
                .AllowMethods("GET", "POST", "PUT")
                .AllowRequestHeaders("Content-Type");

            corsConfig
                .ForResources("Values4.GetData")
                .ForOrigins("http://localhost")
                .AllowAllMethods()
                .AllowCookies()
                .AllowRequestHeaders("Content-Type", "Foo", "Authorization")
                .AllowResponseHeaders("Foo");
        }
Esempio n. 4
0
 public static void RegisterCors(MvcCorsConfiguration mvcCorsConfiguration)
 {
     mvcCorsConfiguration.AllowAll();
 }
 private void RegisterCors(MvcCorsConfiguration corsConfig)
 {
     //corsConfig.ForAllResources().AllowAllOriginsAllMethodsAndAllRequestHeaders();
     corsConfig.ForAllOrigins().AllowCookies().AllowAll();
 }