0

I'm working on a webshop in which it should be possible to subscribe to a service for a monthly 20$ fee in return.

I've made a script in a c# usercontrol which will be called monthly by umbraco scheduled task command:

<task log="true" alias="test60" interval="60" url="http://mysite/umbraco/subscriptionPayment.aspx"/>

For that I have two questions.

1) Where should I put the usercontrol in order to make it unaccessible for the public but accessible for the umbraco task command? It is very important that the script can only be accessed by local server commands.

2) I would like the script to log a file each time a transaction is made. I'm using the following script:

File.AppendAllText("paymentlog.txt",
                   "Transaction "+transactionNumber.ToString() +" sucessfully executed at "+DateTime.Now.ToString() + Environment.NewLine);

I just don't know which path I should give to the paymentlog.txt file since handling real paths in umbraco seems kind of obscure to me. I would like the paymentlog.txt file to be placed in the root umbraco folder. How do I do that?

Thanks in advance (I'm running umbraco 4.8 and uCommerce 2.6.1).

Best regards, Brinck10

2 Answers2

0

The task scheduler in umbraco isn't very reliable and this sounds like a crucial to your businness so i would probably try to use the build in scheduler in Windows on your server to do the processing.

That being said. In regards to marking the tasks scheduler approach a little more secure you could make the URL you are calling only accessible on localhost/127.0.0.1 and use localhost address in your task configuration.

jakobandersen
  • 1,399
  • 7
  • 9
0

You can make a call to the user service to verify that the caller is logged in. Following code will achieve that:

using UCommerce.Infrastructure;
using UCommerce.Security;

var authService = ObjectFactory.Instance.Resolve<IAuthenticationService>();
if (authService.IsAuthenticated())
{
  // do secure code here
}
Søren Spelling Lund
  • 1,622
  • 1
  • 13
  • 18