title: Logged In User On Client showing to Other Page
body: <p>I have three pages: Login.aspx, Index.aspx and a C# class file named GlobalData.cs</p>
  
  <p>The code behind the Login.aspx to get user information from google and to display on the Index.aspx</p>
  
  <p>Here is Code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using DotNetOpenAuth.OpenId;
  using DotNetOpenAuth.OpenId.RelyingParty;
  using OpenIdTest;
  using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
  using System.Web.Security;
  using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;  
  
  public partial class Account_Login : System.Web.UI.Page
  {
  
      protected void Page_Load(object sender, EventArgs e)
      {
  
          FuncOpenID();
  
      }
  
      protected void FuncOpenID()
      {
          OpenIdRelyingParty OIDRP = new OpenIdRelyingParty();
          var response = OIDRP.GetResponse();
          if (response != null)
          {
              switch (response.Status)
              {
                  case AuthenticationStatus.Authenticated:
  
                      var fetchResponse = response.GetExtension&lt;FetchResponse&gt;();
                      Session["GoogleIdentifier"] = fetchResponse;
                      var Testresponse = Session["GoogleIdentifier"] as FetchResponse;
  
                      GlobalData.Email = Testresponse.GetAttributeValue(WellKnownAttributes.Contact.Email) ;
                      GlobalData.Name = Testresponse.GetAttributeValue(WellKnownAttributes.Name.First) ;
                      GlobalData.LastName = Testresponse.GetAttributeValue(WellKnownAttributes.Name.Last); 
                      FormsAuthentication.RedirectFromLoginPage(GlobalData.Email, false);   //(response.ClaimedIdentifier, false);
                      FormsAuthentication.RedirectFromLoginPage(GlobalData.Name, false);
                      FormsAuthentication.RedirectFromLoginPage(GlobalData.LastName, false); 
                      break;
                  case AuthenticationStatus.Canceled:
  
                      break;
                  case AuthenticationStatus.Failed:
  
                      break;
              }
          }
      }
  
  
  
      protected void OpenLogin_Click(object src, CommandEventArgs e)
      {
          string StrUri = e.CommandArgument.ToString();
          OpenIdRelyingParty openid = new OpenIdRelyingParty();
          var b = new UriBuilder(Request.Url) { Query = "" };
  
          var req = openid.CreateRequest(StrUri);
  
          var fetchRequest = new FetchRequest();
          fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
          fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.First);
          fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Last);
  
          req.AddExtension(fetchRequest);
  
          req.RedirectToProvider();
  
      }
      protected void btnLoginToGoogle_Click(object sender, EventArgs e)
      {
  
      }
  
  }
  </code></pre>
  
  <p><strong>Update</strong>
  And the code behind the class file is below:</p>
  
  <pre><code>    using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Web;
  
      namespace OpenIdTest
      {
          public class GlobalData
          {
              public  string Email = "";
              public  string Name = "";
              public  string LastName = "";
              public  string test = "";
              public  string FullName = "";
  
          }
  </code></pre>
  
  <p>And the code behind the Index.aspx is below:</p>
  
  <pre><code>namespace OpenIdTest
  {
  
  public partial class Rights : System.Web.UI.Page
  {
  
      protected void Page_Load(object sender, EventArgs e)
      {
  
          Session["U_EMAIL"] = GlobalData.Email;
          Session["U_NAME"] = GlobalData.Name;
          Session["U_LASTNAME"] = GlobalData.LastName;   
  
  
          OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=|DataDirectory|OID.mdb;Persist Security Info=False;");
  
          con.Open(); 
          OleDbCommand cmd = new OleDbCommand();
          cmd.CommandText = "Select * from EMAILS WHERE FLAG='Allowed' and  EMAIL= '" + GlobalData.Email + "'";
  
          cmd.CommandType = CommandType.Text;
          cmd.Connection = con;
          OleDbDataAdapter da = new OleDbDataAdapter(cmd);
          DataSet ds = new DataSet();
          da.Fill(ds);
  
          foreach (DataRow row in ds.Tables[0].Rows)
          {
  
            String email = row["EMAIL"].ToString();
            if (email == null)
            {
                Response.Redirect("Login.aspx");
  
            }
            else
            {
                Label2.Text = Session["U_EMAIL"].ToString();
                Label1.Text = Session["U_NAME"].ToString();
                Label3.Text = Session["U_LASTNAME"].ToString();
                Label1.Visible = false;
                Label3.Visible = false;
                Label4.Text = Label1.Text + ' ' + Label3.Text;
  
            }
  
          }
          con.Close(); 
      }
  
  
  
  }
  }
  </code></pre>
  
  <p>Now I am writing my serious Issue which i am facing.My Mechanism for my webpage for using openid is that when user Click on Login button on Login.aspx it takes the user to google mail after authenticating from google the user come back to the Index.aspx.And Here on INdex.aspx I have reauthenticate the user from mY own DB that if the email which google have  returned exists in My DB then the user should view the page and if the email dnt Exist in DB then user Redirects to the Login.aspx.Ok Now problem is that When I logged into Index.aspx after authenticating from both Google and My Own DB the Index.aspx Shows accurate information like email Fullname etc On Index.aspx.and mean while if I login to Index.aspx from anyother Browser or PC or Session then also user logged into Index.aspx Succesfuly.And When I refresh the First Logged Index.aspx then It displays the Second logged in user information on Current Index.aspx page.It mean when Multiple users are trying to Login into Index.aspx then On each refresh the on Index.aspx dispalys the Information of last user login to Index.aspx on Index.aspx.Can Anyone tell me What exactly I am Missing Thats why this issue is Displaying.I have Put My all code of allpages please help what i have to add in code or remove from code</p>