Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 96827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:53:16+00:00 2026-05-10T23:53:16+00:00

I have a problem with a oneway web method that open a moss site

  • 0

I have a problem with a oneway web method that open a moss site (probably because in a oneway webmethod the context is null)

Is possible to rewrite this code to remove the null reference exception? (without the oneway attribute i don’t have the exception)

[SoapDocumentMethod(OneWay = true)]         [WebMethod(Description = 'TestOneWay')]         public voidTestOneWay(string webUrl)         {             using (SPSite site = new SPSite(webUrl))             {                  ....             }          } 

the exception is:

[2304] Error:Object reference not set to an instance of an object. [2304] w3wp.exe Error: 0 : [2304StackTrace:   at System.Web.Hosting.ISAPIWorkerRequestInProc.GetAdditionalServerVar(Int32 index) [2304]    at System.Web.Hosting.ISAPIWorkerRequestInProc.GetServerVariable(String name) [2304]    at System.Web.HttpRequest.AddServerVariableToCollection(String name) [2304]    at System.Web.HttpRequest.FillInServerVariablesCollection() [2304]    at System.Web.HttpServerVarsCollection.Populate() [2304]    at System.Web.HttpServerVarsCollection.Get(String name) [2304]    at System.Collections.Specialized.NameValueCollection.get_Item(String name) [2304]    at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous) [2304]    at Microsoft.SharePoint.SPRequestManager.GetContextRequest(SPRequestAuthenticationMode authenticationMode) [2304]    at Microsoft.SharePoint.Administration.SPFarm.get_RequestNoAuth() [2304]    at Microsoft.SharePoint.SPSite.CopyUserToken(SPUserToken userToken) [2304]    at Microsoft.SharePoint.SPSite.SPSiteConstructor(SPFarm farm, Guid applicationId, Guid contentDatabaseId, Guid siteId, SPUrlZone zone, Uri requestUri, String serverRelativeUrl, Boolean hostHeaderIsSiteName, Uri redirectUri, Pairing pairing, SPUserToken userToken) [2304]    at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken) [2304]    at Microsoft.SharePoint.SPSite..ctor(String requestUrl) [2304]    at Reply.Moss2EAI.SPHandler.GetAllFlowConfiguration(String webUrl, String flowConList) [2304]    at Reply.Moss2EAI.EaiMossIntegration.GetMessagesFromEai(String webUrl, String listName, String applicationName) 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:53:17+00:00Added an answer on May 10, 2026 at 11:53 pm

    i have found a workaround to solve my problem.Create new HttpContext. The question now is: is it the right solution or there are implications that i don’t consider?

    the method that i use to change the context is this:

    //Call this before call new SPSite()  private static void ChangeContext(string webUrl)         {             Trace.TraceInformation('ChangeContext');             HttpContext current = HttpContext.Current;             HttpRequest request = new HttpRequest('', webUrl, '');             HttpContext.Current = new HttpContext(request, new HttpResponse(new StringWriter(CultureInfo.CurrentCulture)));             HttpContext.Current.User = current.User;         } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 100k
  • Answers 100k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you have PHP installed on your server, you can… May 11, 2026 at 7:55 pm
  • Editorial Team
    Editorial Team added an answer I got a similar error before but the message is… May 11, 2026 at 7:55 pm
  • Editorial Team
    Editorial Team added an answer Yeah, I've seen this kind of thing before too. Not… May 11, 2026 at 7:55 pm

Related Questions

Say, for example, I have many web applications using the same class library compiled
I am doing some work on a web site that has a secure area
The company that I work for develops a C++ application to manage service businesses
I ran across a new problem in the last week. Due to the nature

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.