Friday, July 27, 2018

WebApi - Enable to CORS - cross domain - get Json format

WebApiConfig.cs under App_Start

using System.Net.Http.Headers;
using System.Web.Http;
using System.Web.Http.Cors; 


// Web API configuration and services
            var cors = new EnableCorsAttribute("*", "*", "*");
            config.EnableCors(cors);


config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

//This will get JSOn format
            config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));

No comments:

Power Automate + Excel data

Extract excel data, get manager and update row with user details which will get from GET MANAGER Concepts and examples Key column:  Column i...