Working with Umbraco Node factory in ajax webservice

Go To StackoverFlow.com

3

I created an .asmx web service which i call via Ajax. i used the following code

Node iLike = Node.GetCurrent().Parent as Node;
       Property Subject = iLike.GetProperty("emailToAdminSubject") as Property;
       Property BodyText = iLike.GetProperty("fbEmailToAdmin") as Property;

but Node.GetCurrent() returning a null. is there any way to get current node in an asmx Web service ?

2012-04-04 05:12
by Ajmal VH


1

Node.GetCurrent() won't work in the context of a web service. (See this forum topic.) You could pass the current node's Id to the web service with your ajax call and then use...

Node iLike = new Node(id).Parent;

...from there.

2012-04-04 19:30
by Douglas Ludlow
Thank you very much @dludlow; Perfect solution : - Ajmal VH 2012-04-05 15:18
You're quite welcome - Douglas Ludlow 2012-04-05 15:27
Ads