Question? What do I have to add to the Web.config file so th

Posted by Community Admin on 03-Aug-2018 22:53

Question? What do I have to add to the Web.config file so that I can run my own custom asmx web services through http post

All Replies

Posted by Community Admin on 23-Jan-2012 00:00

To anyone which can point me in the correct direction.

SiteFinity Version 4.3

Before I started to modify the sitefinity web.config file (to run ASMX http Post web services).  I wanted to know if anyone has explicit instructions on what comands I need to add to the web.config file with out causing harm to the already established site finity web services.

Still can not get http-post request for jquery asmx web services to run. .NET 4.0 does it right out of the box with out any modifications to the web.config file?


This same code works on standard website...just fine...produces error when ran with sitefinity

//JAVASCRIPT FILE
    <script type = "text/javascript">
        $(function ()
            $("#txtMySampleTextBox").keypress(function ()
                $.ajax(
                    type: "POST",            //GET or POST or PUT or DELETE verb
                    url: "AppServices/MySimpleService.asmx/HelloWorld",
                    data: "",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data)
                        alert(data.d);
                        alert($("#txtMySampleTextBox").val());
                    ,
                    error: function (XMLHttpRequest, textStatus, errorThrown)
                        alert(textStatus);
                    
                );
            );
        );
    </script>
 
// here is my web service code (which works on the local host when calling directly)
        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string HelloWorld()
        
            return "Hello World";
        


thanks,

doug Lubey of louisiana

Search engine reference:
HTTP POST  and web.config
HTTP POST  and web.config asmx
sitefinity asmx webservices web.config
enable http post web.config asmx .net 4.0
enable http-post web.config asmx .net 4.0
http-post web.config asmx .net 4.0 settings
http-post web.config asmx .net 4.0 jquery json
asmx webservices web.config webHttpBinding
http-post not available asmx
asmx webservices web.config webHttpBinding
asmx  enable webHttpBinding asp.net 4.0
webservice asmx
webservice asmx web.config
enable httppost web.config
enable web.config asmx json
web.config http json
httppost web service
http-post webservice
simple jquery asmx $.ajax call

Posted by Community Admin on 24-Jan-2012 00:00

OK got it working: 
Thanks to this post:
http://www.sitefinity.com/devnet/forums/sitefinity-4-x/developing-with-sitefinity/using-ajax-methods-from-a-widget-usercontrol.aspx

I was actually missing some commands in the asmx file

//ASMX file code  (I did not have to make any changes to the web.config file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
 
 
namespace SC
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]  
    [WebService(Namespace = "www.yourwebsite.org")]
    [ScriptService]
    public class SCServicesAlliance : System.Web.Services.WebService
    
 
        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string HelloWorld()
        
            return "Hello World";
        
 
    





search engine reference:
asmx ajax
ajax not working asmx

Posted by Community Admin on 14-Feb-2012 00:00

Doug,
What did you have to do to get the service method to execute without invoking the Sitefinity PageRouteHandler? I've got a .svc service, executing the same way your service is in a jquery ajax postback, but the PageRouteHandler is intercepting it. Thanks.

Posted by Community Admin on 14-Feb-2012 00:00

With Sitefinity;  I choose the easiest route and used asmx pages....
We typically now use svc calls (becuase they are better)....but I was having other problems with SiteFinity so I went with the very basic easist calls.

and I also use jquery service calls (not anything to do with the ajax toolkit).

-doug

Posted by Community Admin on 14-Feb-2012 00:00

Doug - Still the same problem with the ASMX service. PageRouteHandler intercepts it. Did you have to set up a separate handler to make sure the site managed the service properly, or is there a setting somewhere else that I'm missing? Thanks.

Posted by Community Admin on 15-Feb-2012 00:00

How do you know it is being intercepted.
I created a sample page and first tested the webserve on a plain aspx page (not even in the virtual frame work of SITEFINITY)

I then migrated the proof of concept into a CONTROL (which is inherited into site finity).  MAYBE YOU ARE USING RELATIVE LINKS for the web service call.  I have had extreme problem with relative links.  TRY HARD-CODING THE FULL PATH OF THE ASMX SERVICE (assuming you are working on the same domain or PROXY SERVICE).

-doug

This thread is closed