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
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";
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";
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.
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
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.
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