I have a default provider-hosted application. when i publish it on rackspace server i got this error:
System.NullReferenceException: Object reference not set to an instance of an object. at Portal.TokenHelper.GetAccessToken(String refreshToken, String targetPrincipalName, String targetHost, String targetRealm) at Portal.SharePointAcsContext.RenewAccessTokenIfNeeded(Tuple`2& accessToken, Func`1 tokenRenewalHandler) at Portal.SharePointAcsContext.GetAccessTokenString(Tuple`2& accessToken, Func`1 tokenRenewalHandler)
My code:
private void GetSPUserDetails(HttpContextBase httpContextBase, dynamic viewBag)
{
var spContext = SharePointContextProvider.Current.GetSharePointContext(httpContextBase);
// Store SPHostUrl in ViewBag
viewBag.SPHostUrl = spContext.SPHostUrl.AbsoluteUri.TrimEnd('/');
using (var clientContext = spContext.CreateUserClientContextForSPHost())
{
if (clientContext != null)
{
var user = UserHelper.GetCurrentUserInfo(clientContext);
// Store typically used variables in ViewBag
viewBag.WebTitle = user.WebTitle;
viewBag.UserLogin = user.Email;
viewBag.UserName = user.Title;
}
}
}
I'm using WebDeploy to publish my portal.
It's a provider-hosted app for SharePoint Online (o365) using VS2013
can anyone help me on this?
Thanks for your time.
System.NullReferenceException: Object reference not set to an instance of an object. at Portal.TokenHelper.GetAccessToken(String refreshToken, String targetPrincipalName, String targetHost, String targetRealm) at Portal.SharePointAcsContext.RenewAccessTokenIfNeeded(Tuple`2& accessToken, Func`1 tokenRenewalHandler) at Portal.SharePointAcsContext.GetAccessTokenString(Tuple`2& accessToken, Func`1 tokenRenewalHandler)
My code:
private void GetSPUserDetails(HttpContextBase httpContextBase, dynamic viewBag)
{
var spContext = SharePointContextProvider.Current.GetSharePointContext(httpContextBase);
// Store SPHostUrl in ViewBag
viewBag.SPHostUrl = spContext.SPHostUrl.AbsoluteUri.TrimEnd('/');
using (var clientContext = spContext.CreateUserClientContextForSPHost())
{
if (clientContext != null)
{
var user = UserHelper.GetCurrentUserInfo(clientContext);
// Store typically used variables in ViewBag
viewBag.WebTitle = user.WebTitle;
viewBag.UserLogin = user.Email;
viewBag.UserName = user.Title;
}
}
}
I'm using WebDeploy to publish my portal.
It's a provider-hosted app for SharePoint Online (o365) using VS2013
can anyone help me on this?
Thanks for your time.