• Install the package Microsoft.AspNet.WebApi.Cors
  • Add in Startup.cs: app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
  • Do not add in SimpleAuthorizationServerProvider.cs: context.OwinContext.Response.Headers.Add(“Access-Control-Allow-Origin”, new[] { “*” });

In case the problem still persists
- Add in Startup.Auth.cs: app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

--

--

When attempting to import voluminous files to your database. Sometimes phpMyAdmin shows an error ‘Incorrect format parameter’.

This can come back to several reasons, mainly the size of the file and the execution time.

To solve this, change in these three files:

  • apache php.ini
  • apache http.conf
  • wamp64\alias\phpmyadmin.conf

These values:

max_execution_time = 5000

max_input_time = 5000

memory_limit = 1000M

post_max_size = 750M

upload_max_filesize = 750M

Schema problem

This problem can also result if you have different schemas in the database you are importing to.
So in order to avoid this problem; before importning make sure you have the schema.

SELECT * FROM information_schema.SCHEMATA S
WHERE schema_name = “myDataBase”;

--

--

This post is to help you enhance the security of your app and prohibit any third party from seeing your app’s data current methods, arguments, etc.

In order to do this there’s two options:

Either add in Web.config/system.web

<customErrors defaultRedirect=”~/Error.html” mode=”On”></customErrors>

Or create your own response with the HttpStatusCode of an error, example :

return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message);

return Request.CreateResponse(HttpStatusCode.OK, “User edited”);

--

--

The best format to return from a Web API is JSON.
JS front-end frameworks (suck as Angular2+), work better when receiving JSON responses.
In order to do that, the code below should be added in:

App_Start/WebApiConfig.cs

GlobalConfiguration.Configuration.Formatters.JsonFormatter.MediaTypeMappings.Add(new System.Net.Http.Formatting.RequestHeaderMapping(“Accept”,“text/html”,StringComparison.InvariantCultureIgnoreCase,true,“application/json”));

Screenshot of the code to add

Clean the solution and build :).

--

--