NHttp icon indicating copy to clipboard operation
NHttp copied to clipboard

How can enable cross origin using nHttp

Open araad1992 opened this issue 8 years ago • 2 comments

Hi we are using the project and with own request this work correctly, now when start the server and call a function from another page appear error of cross origin.

The library have the property of enable the cross origin for the request?

1

Also try this form, but not sure if is correctly:

e.Response.ContentType = "application/json"; e.Response.Headers.Add("Access-Control-Allow-Origin", "*"); e.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST"); e.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type");

araad1992 avatar Aug 25 '17 16:08 araad1992

Hi,

Try add this:

e.Request.Headers.Add("Access-Control-Allow-Origin", "*"); e.Request.Headers.Add("Access-Control-Allow-Methods", "GET, POST"); e.Request.Headers.Add("Access-Control-Allow-Headers", "Content-Type");

marcosjlima avatar Jan 18 '19 12:01 marcosjlima

Hi ,i also had the same issue what helped me is the following: e.Response.Headers.Add("Access-Control-Allow-Origin", "*"); e.Response.Headers.Add("Access-Control-Allow-Methods", "GET, POST"); e.Response.Headers.Add("Access-Control-Allow-Headers", "Content-Type");

hope it helps

ajmal-ahmed avatar Feb 01 '19 09:02 ajmal-ahmed