Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dennis Present 1 post 21 karma points
    Jun 11, 2012 @ 14:37
    Dennis Present
    0

    Base service 404 on staging

    Hi all,

    I created on a local umbraco a few baseservices which work fine on my local machine, but when I deploy the site to our staging server the service give a 404 server error. 

    We know that the code from the service gets executed because it sends a mail in the code, but something is going wrong with the return value. 

    The service : 

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Net.Mail;
    using System.Web.Security;
    
    namespace TheseDays.Business
    {
        public class BaseLibrary
        {
            public static string UserExists(string name)
            {
                var user = Membership.GetUser(name);
    
                if (user != null)
                {
                    return "true";
                }
                else
                {
                    return "false";
                }
            }
    
            public static string ResetUser(string name)
            {
                var user = Membership.GetUser(name);
    
                if (user != null)
                {
                    try
                    {
                        var newPassword = user.ResetPassword();
    
                        var mail = new MailMessage();
    
                        mail.To.Add(user.Email);
                        mail.Subject = "New Password";
                        mail.From = new MailAddress("[email protected]");
                        mail.Body = String.Format("Your new password : {0}", newPassword);
    
                        var client = new SmtpClient();
                        client.Send(mail);
    
                        return "true";
                    }
                    catch (Exception ex)
                    {
                        return "false";
                    }
                }
                else
                {
                    return "false";
                }
            }
        }
    }

    restExtention Settings : 

    <?xml version="1.0" encoding="utf-8"?>
    <RestExtensions>
      <!--
        <ext assembly="umbraco" type="umbraco.presentation.umbracoBase.library.member" alias="currentMember">
        <permission method="login" allowAll="true" />
        <permission method="logout" allowAll="true" />
        <permission method="id" allowAll="true" />
        <permission method="data" allowAll="true" />
        <permission method="logout" allowAll="true" />
        <permission method="setProperty" allowAll="false" />
      </ext>
    -->
      <ext assembly="TheseDays.Business" type="TheseDays.Business.BaseLibrary" alias="BaseLibrary">
        <permission method="UserExists" returnXml="false" allowAll="true"/>
        <permission method="ResetUser" returnXml="false" allowAll="true"/>
      </ext>
    </RestExtensions>

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies