Friday, December 27, 2019

How to solve the Preflight CORS error "The requested resource does not support http method 'OPTIONS'"

In this article we review how to solve the Preflight CORS error "The requested resource does not support http method 'OPTIONS'" : 405 method not allowed :




For several CORS requests, the browser sends a previous request, named "preflight request", before it sends the actual request for the resource.
It is not enought to use the standard CORS (Cross Origin Resource Sharing) on web.config , in order to solve the problem.
Here you can see the web.config settings, usually arranged to solve the problem :







How to solve the Preflight CORS error "The requested resource does not support http method 'OPTIONS'" using WebApi and Angular7



The issue appears while crossing domains, and relates to POST, PUT, PATCH, and DELETE methods:
here you can see several requests , also from the Angular 7 app, as from POSTMAN :








As said, it is not enought to set the web.config to CORS.
Now,  usually the browser sends a previous request to the request that you are sending, named "preflight request", before it sends the actual request for the resource. This Preflight request is of OPTIONS type.
If the response headers do not allow the required HTTP METHOD, the browser do not send it.

The problem is, the WebApi app has not an action to process the Preflight OPTIONS request :



That is what the error is trying to say us.

So, just write an action for OPTIONS verb, that only responds an "OK", as this :



Now try again. Send a request. The breakpoint will show the OPTIONS request being processed :



Immediately after, the intended request is taken care of:





That solves this issue.
Have a good day :-)

Enjoy Angular.....

      by Carmel Schvartzman

כתב: כרמל שוורצמן

Friday, December 6, 2019

jQuery Plugin to create Custom Animations

This review brings to you a free jQuery Plugin to create Custom Animations to be used into your Website , for both mobile and desktop displays . If you need some HTML5 specific animation to show your own customized reactions to the User's interactions, you can create your own jQuery animation and use it again and again:


Custom FREE  jQuery Plugin for creating custom Animations at runtime

jQuery Plugin to create Custom Animations

jQuery Plugin to create Custom Animations





jQuery Plugin to create Custom Animations


1) Using the present jQuery plugin, you can create your own Custom Animations and use them in your website. 
2) This jQuery plugin includes support for all CSS3 changes
3) Also includes callback functions and speed settings.
This Plugin can be get from the following GitHub repository:
https://github.com/CarmelSoftware/jQueryPlugin_CustomAnimation


The Plugin usage is explained in the following Tutorial:

Snapshots: mobile devices :

jQuery Plugin to create Custom Animations

jQuery Plugin to create Custom Animations

desktop machines :


jQuery Plugin to create Custom Animations




Plugin Utilization:

This jQuery Plugin for Custom Animations can be used as follows:

1) Custom animation creation  :

jQuery Plugin to create Custom Animations





2) How to use the custom jQuery plugin in the code:

jQuery Plugin to create Custom Animations
jQuery Plugin to create Custom Animations



by Carmel Schvartzman - The MVC Club - The HTML5 Club


פיתוח: כרמל שוורצמן