i have a very basic C# understanding but i want to create my own blog for my own website...
here my code so far:
i have problems by calculatings the 3 labels, tuit from the current person, followed people from the current person and total of tuits together with all people.
The other problem, if i log for exemple tom 1 own tuit or Anna two own tuits have to be displayed by login and if they follow someone those tuits has to be also shown but not all tuits from the tuitterMessages.txt...
How can i handel this? need some example please...
another point when i follow one potential user the code is good if i want to follow a second one i have an error, what is wrong? then user also appear 3 time each after i follow the first one.
If i want to remove the person i follow i can not the page blocked...
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class TuitterWebste_TuitterLogin : System.Web.UI.Page
{
    protected void Page_PreRender(object sender, EventArgs e)
    {
        //Populate unfollowDropDownList with users that want to follow.
        string[] tuitterFollowerArray = File.ReadAllLines(Server.MapPath(" ") + "/App_Data/tuitterUsers.txt");
        string[] userFollowerPair;




        for (int h = 1; h < tuitterFollowerArray.Length; h++)
        {
            userFollowerPair = tuitterFollowerArray[h].Split(' ');
        }


        for (int v = 0; v <= unfollowDropDownList.Items.Count; v++)
        {


        }
        //creating array for Tuit messages
        string[] tuitterArray = File.ReadAllLines(Server.MapPath("") + "/App_Data/tuitterMessages.txt");
        string[] tuitterMessageArray = File.ReadAllLines(Server.MapPath(" ") + "/App_Data/tuitterMessages.txt");
        //reverse tuitMessages in Array
        Array.Reverse(tuitterMessageArray);
        //Empty the tuitTextBox
        tuitTextBox.Text = "";
        //displaying the tuit messages
        for (int i = 0; i < tuitterMessageArray.Length; i++)
        {
            tuitTextBox.Text += tuitterMessageArray[i] + System.Environment.NewLine;
        }
        //displaying the tuit messages
        for (int i = 0; i < tuitterMessageArray.Length; i += 3)
        {
            
        }
    }


    protected void Page_Load(object sender, EventArgs e)
    {
        string[] tuitterNameArray = File.ReadAllLines(Server.MapPath(" ") + "/App_Data/tuitterUsers.txt");


        //Populate followDropDownList with users that you can follow.
        if (!IsPostBack)
        {




        }
        for (int i = 1; i < tuitterNameArray.Length; i++)
        {
            string[] userNamePair = tuitterNameArray[i].Split(' ');
            followDropDownList.Items.Add(userNamePair[0]);




            // use a session to greet User per his name.
            try
            {
                string usernameString = Session["User"].ToString();
                welcomeLabel.Text = "Welcome " + usernameString + "!";
                welcomeLabel.Text = Convert.ToString("Welcome" + Session["User"]);
            }
            catch
            {
                Response.Redirect("TuitterLogIn.aspx");
            }


            //creating array for Tuit messages
            string[] tuitterArray = File.ReadAllLines(Server.MapPath("") + "/App_Data/tuitterMessages.txt");
            string[] tuitterMessageArray = File.ReadAllLines(Server.MapPath(" ") + "/App_Data/tuitterMessages.txt");
            //reverse tuitMessages in Array
            Array.Reverse(tuitterMessageArray);
                  


            //displaying total tuits
            for (int j = 0; j < tuitterMessageArray.Length; j++)
            {
                string[] splitName = tuitterMessageArray[j].Split(' ');
                totalNbLabel.Text = Convert.ToString(tuitterMessageArray.Length / 3);
            }
            //displaying tuits by current user
            int counter = 0;
            for (int g = 0; g < tuitterMessageArray.Length; g++)
            {
                if (tuitTextBox.Text == tuitterMessageArray[g].ToString())
                {
                    tuitTextBox.Text += tuitterMessageArray[g].ToString();
                    counter++;
                    tuitNbLabel.Text = counter.ToString();
                }
            }




            //displaying follower by current user


            for (int k = 0; k < tuitterMessageArray.Length / 3; k++)
            {
                if (unfollowDropDownList.Text == tuitterMessageArray[k].ToString())
                {
                    unfollowDropDownList.Text += tuitterMessageArray[k].ToString();
                    counter++;
                    followingNbLabel.Text = counter.ToString();




                }
            }
        
        }
    }
    
    protected void tuitterImageButton_Click(object sender, ImageClickEventArgs e)
    {


        // drag blog from  tuitMessagesTextBox  to tuitTextBox
        // Use AppendAllText to write in the box for the first line/box
        File.AppendAllText(Server.MapPath(" ") + "/App_Data/tuitterMessages.txt", System.Environment.NewLine + ("\n") + DateTime.Now.ToString()  +("\n") + tuitMessagesTextBox.Text  +  ("\n") + welcomeLabel.Text);
        
        string[] tuitterMessageArray = File.ReadAllLines(Server.MapPath(" ") + "/App_Data/tuitterMessages.txt");
        //reverse tuitMessages in Array
        Array.Reverse(tuitterMessageArray);
        
        for (int i = 0; i < tuitterMessageArray.Length; i++)
        {
            tuitTextBox.Text = tuitTextBox.Text + "\n" + tuitterMessageArray[i];
            
        }
       
    }
    protected void followImageButton_Click(object sender, ImageClickEventArgs e)
    {
       
        // drag can follow tuitter in the unfollow box 
        unfollowDropDownList.Items.Add(followDropDownList.SelectedValue);
        
        //selected user is going to the i follow box when the follow button is clicked
        followDropDownList.Items.Remove(followDropDownList.SelectedValue);
        
    }
    protected void unfollowImageButton_Click(object sender, ImageClickEventArgs e)
    {
        //Populate unfollowDropDownList with users that i want to follow.
        followDropDownList.Items.Add(unfollowDropDownList.SelectedValue);
        
        //selected user is going back to the i can follow box when the follow button is clicked
        unfollowDropDownList.Items.Remove(unfollowDropDownList.SelectedValue);
    }
    protected void tuitTextBox_SelectedIndexChanged(object sender, EventArgs e)
    {
        
    }
}