0

I try to move a piece of my old code to a DNN Module. The Code calls a Webservice (asmx) via JQuery and display's the Result. I placed the ASMX File here : DesktopModules.MyModule.Service and the Code Behind into the App_Code\MyModule Folder.

I can call the Service directly via http://localhost/DNN/DesktopModules/myModule/Service/myService.asmx - no Problem so far :-)

But calling the Service from the Module with this Script

GetStats = function () {

$.ajax(
 {
     type: "POST",
     url: "http://localhost/DNN/DesktopModules/myModule/Service/myService.asmx",
     data: '{}',
     contentType: "application/json; charset=utf-8",
     dataType: "json",
     failure: function (msg) {
          Failure while call : " + msg);
     },
     error: function (xhr, err) {
          Error while call : " + err);
     },
     success: function (response) {}});
  };

End with Error Code 400, it seems that the URL is rewritten ?!

I enter "http://localhost/DNN/DesktopModules/myModule/Service/myService.asmx" and the Code goes to this URL "/dnn/Default.aspx?tabid=82/myService.asmx"

Friendly Urls are off and there is no rewriter in place...

I just can't find a way - any help is welcome :-)

Peter

1 Answers1

0

you need a new entry in siteurl.config, here it is for you.

<RewriterRule>
    <LookFor>.*myService.asmx(.*)
    <SendTo>~/DesktopModules/myModule/Service/myService.asmx$1
</RewriterRule>

That will fix your problem.

Another good thing about this is, if you do, localhost/myService.asmx it will still work because of that rule

Prashant Lakhlani
  • 5,758
  • 5
  • 25
  • 39