More in this section

Forums / Developing with Sitefinity / 4.1 SP2 - 401 on Users.svc Web Service Call

4.1 SP2 - 401 on Users.svc Web Service Call

7 posts, 0 answered
  1. Tim
    Tim avatar
    258 posts
    Registered:
    22 Jun 2011
    06 Jul 2011
    Link to this post
    Hey everyone!

    I'm doing some work with the Sitefinity web services and I've hit a small snag...

    Yesterday, I upgraded to SP2. After a successful upgrade, I was unable to connect to the Authenticate service. Instead of the status code I was given before, I'm now greeted by a 401 and the following message:

    {
        "Message": "Authentication failed.",
        "StackTrace": null,
        "ExceptionType": "System.InvalidOperationException"
    }

    I had everything functioning before the upgrade so I'm confident that the code worked on SP1. Did something change or am I just doin' it wrong? :)

    Additional notes:
    I've re-checked the configuration against the Sitefinity Installation guide, it seems good.
    I'm able to hit the services via browser (after I provide login credentials of course)
    The site itself seems to work as expected. I'm able to log in and click around in the admin.

    Thanks in advance!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Jul 2011
    Link to this post
    Hi Tim,

    Can you show the code that you use for authentication? Form where you call it and how?

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Tim
    Tim avatar
    258 posts
    Registered:
    22 Jun 2011
    06 Jul 2011
    Link to this post
    Ivan,

    I'm doing this in Java, here's the applicable code:

     
    String jsonData = String.format("{\"MembershipProvider\":\"%s\",\"UserName\":\"%s\",\"Password\":\"%s\",\"Persistent\":%s}", membershipProvider, userName, password, rememberMe);
    HttpPost request = new HttpPost(authPath);
    HttpClient client = new DefaultHttpClient();
    HttpResponse httpResponse;
     
    StringEntity se;
    try {
        se = new StringEntity(jsonData);
        request.setEntity(se);
    } catch (UnsupportedEncodingException e1) {
        e1.printStackTrace();
    }
     
    request.addHeader("Content-Type", "application/json");
     
    try {
        httpResponse = client.execute(request);
     
    ...

    I appreciate it!
  4. Tim
    Tim avatar
    258 posts
    Registered:
    22 Jun 2011
    07 Jul 2011
    Link to this post
    I'm still looking for a solution. Did that help to shed some light on any issues that I'm not seeing?

    Looking around on the search engines, I'm seeing people adding things to the web.config. This seems like is a semi-related post from the Telerik forums. (The remote server returned an error: (401) Unauthorized)

    I compared the two web.config files after the upgrade and found no apparent changes. Any necessary inclusions to that file would have been done in the upgrade process from SP1 to SP2, yes?

    Thanks!
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Jul 2011
    Link to this post
    Hello Tim,

    Please check this forum post and try the code from it.


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Ian
    Ian avatar
    7 posts
    Registered:
    02 Mar 2009
    20 Jul 2011
    Link to this post
    Hi Ivan

    Any solution to this?

    I'm using the code from this post

    http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/sitefinity-4-0-rc-integration-with-silverlight-existing-project.aspx

    so it should work OK, but I get a 401 on the line 
    using (var response = (HttpWebResponse)request.GetResponse())

    I'm using an AspNetSqlMembershipProvider, not default.

    Thanks

    Ian
  7. Pavel Iliev
    Pavel Iliev avatar
    140 posts
    Registered:
    18 Jul 2016
    29 Jul 2011
    Link to this post
    Hello Ian,

    This was resolved in 4.1 SP3.

    Kind regards,
    Pavel
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
7 posts, 0 answered