Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7077277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:24:07+00:00 2026-05-28T06:24:07+00:00

I have three pages: Login.aspx, Index.aspx and a C# class file named GlobalData.cs The

  • 0

I have three pages: Login.aspx, Index.aspx and a C# class file named GlobalData.cs

The code behind the Login.aspx to get user information from google and to display on the Index.aspx

Here is 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<FetchResponse>();
                    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)
    {

    }

}

Update
And the code behind the class file is below:

    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 = "";

        }

And the code behind the Index.aspx is below:

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(); 
    }



}
}

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:24:08+00:00Added an answer on May 28, 2026 at 6:24 am

    Information stored at a user level can never be stored in a static. A static property essentially means only one user will ever log into your site, and it will be the information of the last person who logged in. Change your code to store those values in session, and then this problem will go away.

    EDIT: It’s hard to tell what’s going on, but this still looks like a static, so you need to replace this:

    GlobalData.Email = Testresponse.GetAttributeValue(WellKnownAttributes.Contact.Email) ;
    GlobalData.Name = Testresponse.GetAttributeValue(WellKnownAttributes.Name.First) ;
    GlobalData.LastName = Testresponse.GetAttributeValue(WellKnownAttributes.Name.Last); 
    

    With this:

    Session["U_Email"] = Testresponse.GetAttributeValue(WellKnownAttributes.Contact.Email) ;
    Session["U_Name"] = Testresponse.GetAttributeValue(WellKnownAttributes.Name.First) ;
    Session["U_LastName"] = Testresponse.GetAttributeValue(WellKnownAttributes.Name.Last); 
    

    Because again, you can’t use GlobalData since it’s a static.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a base page called let's say Login.aspx with Login.aspx.cs code behind. Now...I
I have 3 asp.net pages: Search.aspx, Results.aspx and Login.aspx. Now I want anonymous users
I have the authentication which will redirect the unregister user to Login.aspx. At the
Coding Platform ASP.NET 4.0 WebForms I have two pages that are relevant here Login.aspx
I developed very simple web site, I have onle three web pages. Logon.aspx Register.aspx
I have some code in an IAuthorizationFilter which redirects the user to a login
I'm playing with a GWT/GAE project which will have three different pages, although it
Say I have three separate color schemes that are used on various pages in
I have an activity with a view pager and three pages to display. When
I have implemented horizontal page view. One base page and three swipe pages. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.