Tag Info

New answers tagged

0

Please check this answer: http://stackoverflow.com/questions/5081251/how-can-this-throw-a-nullreferenceexception SPContext.Current doesn't work under Elevated Privileges, so you have to rewrite like in the answer above.


0

i could be wrong here but isnt SPContext.Current null which is correct as there isnt a current context as you havent signed in yet so there isnt one available ;) use: SecurityToken token = SPFormsUserNameSecurityTokenHandler.CreateSecurityToken(formsClaimsAuthenticationProvider.MembershipProvider, formsClaimsAuthenticationProvider.RoleProvider, username, ...


0

I'm just guessing here, but here are some things that I think could help. Add this JavaScript code to the custom sign in page (before your if-statement): SP.SOD.executeFunc('SP.js', 'SP.ClientContext'); You could also add this JavaScript to your page to test if it works or not, using the console: var clientContext = new SP.ClientContext.get_current(); ...


1

The both site1 and site2 returns the same site collection (SPSite) object. By calling RootWeb property on both objects, We can get the same top-level web site (SPWeb) object. Instruction1: SPSite spsite1=new SPSite(SPContext.Current.Web.URL); Process: If we are in subsite and we are calling the above code, first it get the current subsite web url and pass ...


1

SPSite spsite1=new SPSite(SPContext.Current.Web.Url); will give you SPSite object. But it will be site collection object only when SPContext.Current.Web.Url is that of root web. If the web object is that of a sub site then SPSite object won't be a site collection object. The second statement SPSite spsite2=new SPSite(SPContext.Current.Site); is wrong because ...


1

No that is not possible, you need to understand what a context really is.. when you are running the JavaScript code, it resides within a page/app.. which is SharePoint based.. and thus has the context of what contains it.. The server side code SPContext.Current again has the context because it resides within SharePoint.. Or when you are using Client Object ...



Top 50 recent answers are included