title: SharePoint: SPContext.Current returns null for in SharePoint foundation 2010
body: <p>I am using the below code to access the web-application from sharepoint.</p>
  
  <pre><code>SPWebApplication webApplication = SPContext.Current.Site.WebApplication;
  </code></pre>
  
  <p>it works fine with the sharepoint <strong>server 2010(MOSS2010)</strong>. But when I work with SharePoint foundation 2010(WSS4.0)  <strong>SPContext.Current</strong> always returns null. Can anyone tell me what could be the reason for this? and how can i resolve this issue?</p>
  
  <p>Thanks and regards,
  Sharmila</p>