Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 6th, 2006, 01:46 PM
Registered User
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Persoalization problem...

I have a problem. i am using personalization to load values on the login page.
    protected void Login1_LoggedIn(object sender, EventArgs e)
    {
        string userName = Login1.UserName;
        string password = Login1.Password;

        string query1 = @"SELECT Security.SubscriberID, Security.UserTypeID, Subscribers.Lastname + ', ' + Subscribers.Firstname AS Fullname, Subscribers.Medid, Security.registrationnum FROM Security INNER JOIN Subscribers ON Security.SubscriberID = Subscribers.SubscriberID WHERE UserName = @UserName AND Pwd = @Password";
        string conn1 = (string)ConfigurationManager.ConnectionStrings["typhoonConnectionString1"].ConnectionString;
        SqlConnection myconn = new SqlConnection(conn1);
        SqlCommand command = new SqlCommand(query1, myconn);
        command.Parameters.AddWithValue("@UserName", userName);
        command.Parameters.AddWithValue("@Password", password);
        myconn.Open();
        SqlDataReader reader = command.ExecuteReader();
        reader.Read();
        Profile.doctors.subscriberid = (String.Format("{0}", reader[0]));
        Profile.doctors.usertype = (String.Format("{0}", reader[1]));
        Profile.doctors.fullname = (String.Format("{0}", reader[2]));
        Profile.doctors.medid = (String.Format("{0}", reader[3]));
        Profile.doctors.registrationnum = (String.Format("{0}", reader[4]));
        reader.Close();
        myconn.Close();
    }

I am reading Profile.doctors.fullname on my masterpage, but the problem is that it is not loading the correct data, de data is delay. If you sign with username1 i can not see the values, and if after that you singn with username2 the values are from the username1.

On my masterpage

 LoginName name = (LoginName)LoginView2.FindControl("LoginName1");
        name.FormatString = Profile.doctors.fullname;

But it is not working, i was testing using Response.Write(Profile.doctors.fullname); to see the data and it is alway wrong.

The query works perfect on sql analyzer, but i dont know why i am not loading the data on the profile on my web.config page.

Please help...

Luis












Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.