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

  • SEARCH
  • Home
  • 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 7041157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:00:18+00:00 2026-05-28T02:00:18+00:00

I am using the below code to access the web-application from sharepoint. SPWebApplication webApplication

  • 0

I am using the below code to access the web-application from sharepoint.

SPWebApplication webApplication = SPContext.Current.Site.WebApplication;

it works fine with the sharepoint server 2010(MOSS2010). But when I work with SharePoint foundation 2010(WSS4.0) SPContext.Current always returns null. Can anyone tell me what could be the reason for this? and how can i resolve this issue?

Thanks and regards,
Sharmila

  • 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. Editorial Team
    Editorial Team
    2026-05-28T02:00:18+00:00Added an answer on May 28, 2026 at 2:00 am

    One of the common reasons I’ve seen where SPContext is found to be null is when you have an incorrectly configured AAM. Its really important that sharepoint understands what URLs are configured for your site because if your URL is not registered it cant tell if the URL is inside the SPContext hence create it.

    The most common change Ive seen is modifying the host headers of the
    IIS site. This is an enormous no-no, please don’t ever do this (use
    AAM’s instead). If you do go ahead and modify these any of your newly
    added headers will only be partly functional. Inside of SharePoint
    there is a lot of components which rely directly on the URL and in
    particular on looking this URL up internally. What you find (for the
    developers) is that references to SPContext.Current (a core piece of
    SharePoint goodness) will not work. This causes havoc on random
    SharePoint pages, web parts and custom features.

    Take a look here if you want to know how to setup AAMs (and find out why they are so important) take a look at my blog post on the subject
    http://blog.staticvoid.co.nz/2011/05/sharepoint-alternate-access-mappings.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to access an SQLite 3 database programmatically using the code below:
Below is the code that I'm using in ms access to list the data
Currently i'm using below code which works well. $(#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel).hide(); any optimised code?
I am using below code for Embed MP3 Audio Files In Web Pages, <embed
i am using below code to change the the font type of text view.
I am using below code to create a reminder in Google calendar (using Google
I am trying to change desktop image using below code: NSError *anError = nil;
I wanted to generate a list view using below code. But after running this
As I created a Progress bar using below code in a on click method
In past, I am using Listview and using below code can show a particular

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.