SPContext.Current is null in the web service under the sharepoint site

I am showing a web service on a SharePoint site, for example. http: //server/_vti_bin/subdir/mywebservice.asmx .

In the web service method, it SPContext.Currentappears to be null.

(Interestingly, I look at an example in Chapter 5 of Inside Windows SharePoint Services 3.0 , and they use the service SPContext.Currentinside the website!)

Any idea what I am missing? Thanks in advance.

+5
source share
3 answers

, SPContext.Current = null, - , (.. URL-, ).

"_vti_bin/subdir". subdir WebService, SharePoint ( : - SharePoint)

  • asmx ISAPI 12 . _vti_bin.
  • , , GAC ( -, GAC , )
  • - , ,

, , _vti_bin, . URL- SharePoint .

+2

, - ?

0

What do you call a web service? Is this an ajax call from javascript / jquery? If so, have you added the ScriptService attribute to the webservice class?

[System.Web.Scripts.Services.ScriptService]
public class SimpleWebService : System.Web.Services.WebService
{
    ...
    ...
}
0
source

All Articles