Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

enable cors asp.net mvc

public static void Register(HttpConfiguration config)
{
    var corsAttr = new EnableCorsAttribute("http://example.com", "*", "*");
    config.EnableCors(corsAttr);
}
Comment

enable cors asp.net mvc

public static void Register(HttpConfiguration config)
{
    // New code
    config.EnableCors();
}
Comment

To enable CORS in the MVC Java config

@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {

        registry.addMapping("/api/**")
            .allowedOrigins("https://domain2.com")
            .allowedMethods("PUT", "DELETE")
            .allowedHeaders("header1", "header2", "header3")
            .exposedHeaders("header1", "header2")
            .allowCredentials(true).maxAge(3600);

        // Add more mappings...
    }
}
Comment

enable cors asp.net mvc

Response.AppendHeader("Access-Control-Allow-Origin", "*");
Comment

PREVIOUS NEXT
Code Example
Java :: print in java 
Java :: java how to create an array 
Java :: print statement in java 
Java :: zweidimensionales array ausgeben java 
Java :: java char stream to string 
Java :: reverse java 
Java :: android access main toolbar in fragment 
Java :: how to get elements of a list in java 
Java :: java string vs stringbuilder 
Java :: smart ways to print a matrix in java 
Java :: get data from database sqlite android 
Java :: how to replace an element in array in java 
Java :: java structure example 
Java :: android pass object to activity 
Java :: abstract code in java 
Java :: how to convert string to int in java 
Java :: java check if int 
Java :: java read file from command line argument 
Java :: draw circle with fill java 
Java :: Java String equal String 
Java :: radix sort java 
Java :: Java How to use Queue? 
Java :: How to merge two sorted arrays into a single sorted bigger one? 
Java :: java generics 
Java :: sort list of list java 
Java :: linked list vs array list 
Java :: how to install clojure on linux 
Java :: how to convert string hashcode to color in java android 
Java :: java binary search 
Java :: intellij set target bytecode version 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =