I took a look around before asking this and didn't find anything pertaining to this specifically, this error is easy to find when running in a local environment but not so much when the application is online. What I have is an online application that imports contacts. When I log in with IE, I can import no problem, however when I log in using Chrome, I get this type of error when I try to import contacts from Yahoo or Hotmail. Any idea's on why it works fine when using IE and not when using Chrome?
Stack Trace
[NullReferenceException]: Object reference not set to an instance of an object.
at GSDataCollection.Home.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
[HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.home_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.I ExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
#region Initilization
string myName = Session["LoggedInUser"].ToString();
ds = UC.GetMemberID(myName);
Session["CurrentUserID"] = Convert.ToInt32(ds.Tables["Members"].Rows[0]["MemberID"].ToString());
// Current Groups For User grid
rgCurrentGroups.DataSource = UC.GetMemberGroups(Convert.ToInt32(Session["CurrentUserID"]));
rgCurrentGroups.DataBind();
// Add Contacts to Group grid
rgAddContactsToGroups.DataSource = UC.GetMemberContactsForGrid(Convert.ToInt32(Session["CurrentUserID"]));
rgAddContactsToGroups.DataBind();
// Groups To Select
ddGroupToSelect.DataSource = UC.GetMemberGroups(Convert.ToInt32(Session["CurrentUserID"]));
ddGroupToSelect.DataTextField = "MemberGroupName";
ddGroupToSelect.DataValueField = "MemberGroupsID";
ddGroupToSelect.DataBind();
#endregion
#region Import Contacts
//i.e. outlook
if (Request.QueryString["code"] != null && Request.QueryString["state"] != null)
{
iOutlook io = new iOutlook();
WebServerClient consumer = new WebServerClient(io.server, io.clientID, io.clientSecret);
IAuthorizationState grantedAccess = consumer.ProcessUserAuthorization(null);
string accessToken = grantedAccess.AccessToken;
string returnStr = new System.Net.WebClient().DownloadString("https://apis.live.net/v5.0/me/contacts?access_token=" + accessToken);
dynamic json = System.Web.Helpers.Json.Decode(returnStr);
foreach (var item in json.data)
{
Response.Write(item.name + "</br>" + item.emails.preferred + "</br>------------------------------</br>");
}
}
//Yahoo
string oauth_token = Request["oauth_token"];
string oauth_verifier = Request["oauth_verifier"];
//To Close open window opened by "Login with yahoo" button
if (!string.IsNullOrEmpty(oauth_verifier) && oauth_verifier != "")
{
OauthToken = oauth_token;
OauthVerifier = oauth_verifier;
Page.ClientScript.RegisterStartupScript(GetType(), "refresh", "window.opener.location = 'home.aspx'; self.close();", true);
}
//This will load once we automatically close the login popup window by above if statement
else if (!string.IsNullOrEmpty(OauthVerifier))
{
if (string.IsNullOrEmpty(OauthYahooGuid))
GetAccessToken(OauthToken, OauthVerifier);
//RefreshToken();
RetriveContacts();
//need to set as empty because we don't need to repeat RetriveContacts() condition
OauthVerifier = string.Empty;
}
#endregion
}
}