0
votes

The web service is listed in the IgnoreurlPrefixes list, which I'm guessing has something to do with it. I have another service not listed in that list, and it returns the logged in user. (Not to over complicate things, but it's not clear to me why I'm able to have one service be callable and another not based on whether or not it's in the IgnorURLPrefixes list.)

So the question is: How do I get Sitecore.Context.User to return the logged in user when called from a web service?

2

2 Answers

2
votes

You don't have a Sitecore context because the requested page is ignored by Sitecore and thus not processed by it. If you need a Sitecore context you can't have the URL listed in the IgnorURLPrefixes list...

0
votes

As another answer points out, Siteocre.Context is not available when the URL is listed in IgnoreURLPrefixes. Your best bet is to add a processor to the httpRequestBegin pipeline, that aborts the request before Sitecore attempts to resolve an Item. This way, the context can at least be partially available.

Examples of doing this with MVC routes are abundant.