Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDnnApiController do not receive parameters passed by "POST"DnnApiController do not receive parameters passed by "POST"
Previous
 
Next
New Post
3/4/2013 4:38 AM
 
Hello

I am developing a Module with DnnApiController and I created a class:

public class AuthController : DnnApiController
    {
        [HttpPost]
        [HttpGet]
        [AllowAnonymous]
        public HttpResponseMessage LoginCustomer(string userName, string password, bool rememberMe) {
             { ... }
        }
     }

When I pass parameters by POST, I receive the error:

{"Message":"No HTTP resource was found that matches the request URI 'http://dnndev.me/DesktopModules/ShapeLovers.DNNShapeLovers/API/Auth/LoginCustomer'.","MessageDetail":"No action was found on the controller 'Auth' that matches the request."}

Now, if I test the method by GET it works fine, here is my ajax call:

function doAuthentication() {
        var iuserName = $("#login_username").val();
        var iuserPassword = $("#login_password").val();
        var irememberMe = $("#remember_me").val();   
        
        var moduleScope = $('#<%=ScopeWrapper.ClientID %>'); 
        var sf = $.ServicesFramework(<%=ModuleId %>);

        $.ajax({
            type: "GET",
            url: sf.getServiceRoot('ShapeLovers.DNNShapeLovers') + "Auth/LoginCustomer",
            data: { userName: iuserName, password: iuserPassword, rememberMe: (irememberMe == 'on') },
            beforeSend: sf.setModuleHeaders
        }).done(function (data) {
            data.result);
        }).fail(function (xhr, result, status) {
            Uh-oh, something broke: " + status + " - " + result + " + " + xhr);
        });
    }

Everything work fine using GET, but no POST!!!

I appreciated your help, there is very poor documentation in internet about DNN WebAPI

By Fiddler I check the request is formed like this:

==========================================================================================================

POST http://dnndev.me/DesktopModules/ShapeLovers.DNNShapeLovers/API/Auth/LoginCustomer HTTP/1.1
Accept: */*
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
ModuleId: 414
TabId: 87
__RequestVerificationToken: uACEnFjnC1PKFK-oRtYOgwUVTq5zhNvRyFmgw4PuB3ZDOR_YXjvTIZAw0XWusOtO6mNf0znwzsg1itAabKfXjjv3L3Wm6MGazv5BRzZxKeQ-oieG6t4oNvqFssw1
X-Requested-With: XMLHttpRequest
Referer: http://dnndev.me/CLogin.aspx
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: dnndev.me
Content-Length: 46
Connection: Keep-Alive
Pragma: no-cache
Cookie: .ASPXANONYMOUS=AjglvipHzgEkAAAAZDJjMTM3ZWEtOGYxNi00MTMyLTljYjAtOWU3NTQ5OGRiNzk10; ASP.NET_SessionId=yz25hd2ufczgdpbmtb5jvmak; language=en-US; __RequestVerificationToken=Iqv0eiZVz-AQKzF3h8oOa3A749wovGen9uquia7K8H6oeHF1Sr5rUBMCm_MDziTPIms0iwxtjjbHef1ubUtxAWtECp7oO3YEn6M7YGDjodaRJ9BN1G-pUigb-YI1

userName=rdewfw&password=gwere&rememberMe=True
==========================================================================================================

Regards
Benito.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDnnApiController do not receive parameters passed by "POST"DnnApiController do not receive parameters passed by "POST"


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out