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

Recommended Answers

All 2 Replies

i get "Access denied" error from internet explorer.

Have you configured the web server to listen/accept connections on port 443 and the took care of the installation of the digital certificate?

I defined the project in IIS with port 443 binding, however i dont have the option to install a certificate, instead i used a "self signed" sertificate that can be created from IIS

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.