Hi All,
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.
Further this issue happens only when the feature is deployed to webapplication like http://servername:31148/sites/ProjectA. But when I debug the code in featureActivated then SPContext.Current is available. However it is null when I try to access it from anywhere else.
Can anyone tell me what could be the reason for this? and how can i resolve this issue?
Thanks and regards.
MayaSmitha
SharePoint: SPContext.Current returns null for in SharePoint foundation 2010
Started by mayasmitha, Jan 04 2012 11:09 PM
1 reply to this topic
#1
Posted 04 January 2012 - 11:09 PM
|
|
|
#2
Posted 05 January 2012 - 01:32 AM
I found same question on StackOverflow.. It has one answear that might help you: SharePoint: SPContext.Current returns null for in SharePoint foundation 2010 - Stack Overflow
And here's an older question from stackoverflow that also might help you a bit: sharepoint - Feature Event has 'null' objects - Stack Overflow
And here's an older question from stackoverflow that also might help you a bit: sharepoint - Feature Event has 'null' objects - Stack Overflow
Think my post we're usefull? Please take your time and press the Like button at my post, Big Thanks!
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/
For great C# & Android tutorials visit my blogg: http://www.thecompboy.com/
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









