Hi
I wrote about my problem but with no answer. My deadline is today so if I dont figure out I should found another job :-).
I want to store time that visitor spend on each page. So when he leave a page or close brouser I have to save spend time to Database.
My solution is that onLoad page I create jscript variable with startTime value DateTime.Now()
so on onUnload jscript should call web service and send Diff between startTime and DateTime.Now().
Basicly in some other solution I will use ScriptManager and on Page call my web service like this ..
Quote:
<script type="text/jscript" src="/scripts/timeCountScript.js" ></script>
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/WebServices/sendData.asmx" />
</Services>
</asp:ScriptManager>
and after that call web service method like
ret = sendData.ConfirmExit(timeString, OnComplete, OnTimeOut, OnError);
BUT becouse ScriptManager is already exist in umbraco I have to call this trought code
Quote:
ScriptManager objScriptManager = ScriptManager.GetCurrent(Page);
// Add a reference to the web service
ServiceReference objServiceReference = new ServiceReference();
objServiceReference.Path = "~/webservices/senddata.asmx";
objScriptManager.Services.Add(objServiceReference);
ScriptReference objScriptReference = new ScriptReference();
objScriptReference.Path = "/scripts/timeCountScript.js";
objScriptManager.Scripts.Add(objScriptReference);
The problem was that I always get a message that "....sendData is undefined ...."..
It seams that jscript can found a service...
I exam the other web service that is stored in folde /umbraco/webservices and found that all service have the namespace like ...umbraco.webservices so I put this namespace into my web service.
The result is that when I call web service like
http://localhost/umbraco/webservices/senddata.asmx
I get the list of methid and I can Invoke it and the data is stored in Database ...
SO MY SERVICE WORKING but from page I alvays get the same messsage "....sendData is undefined ...."
What is wrong?
I try to figure out what is the correct path for calling service , I put the all path .."http://localhost/umbraco/webservices/senddata.asm.."
but still nothing
maybe problem is somwere else... I thing that calling web service from jscript is OK ,becouse it work like this in stand alone page that I made for testing purpose...
BUT WHAT is worng
HELP