Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

call WebService over https

$
0
0

hi
i have a simple website that includes a WebService and a Webform page.
i'm trying to call my web service from the web form using jquery.
when i type the web service's url using https, i get "Access denied" error from internet explorer.
the call works just fine when i type http...

my service code:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class WebService : System.Web.Services.WebService {

    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public string HelloWorld(int i) {
        return "Hello World";
    }
}
my client code:
$.ajax
        ({
            type: "POST",
            contentType: "application/json",
            url: "https://localhost:56497/Cors/WebService.asmx/HelloWorld",
            data: "{i:4}",
            dataType: 'json',
            success: function (data) {                
                alert('yes');
            },
            error: function (err) {                
                alert(err.responseText);
            }
        });

i have also tried the following configuration in web.config:
<system.webserver><httpprotocol><customheaders><add name="Access-Control-Allow-Origin" value="*" /><add name="Access-Control-Allow-Headers" value="Content-Type" /></customheaders></httpprotocol></system.webserver>
nothing seems to work

Viewing all articles
Browse latest Browse all 5678

Trending Articles