I'm Writing a Code with ASP.Net to make a Shopping WebSite
and This Error appear :
Object reference not set to an instance of an object.
at this Line of Code :
 tot = tot +(Convert.ToInt32(a[2].ToString())+Convert.ToInt32(a[3].ToString()));  
the Full Code is :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class user_user : System.Web.UI.MasterPage
{
    string s;
    string t;
    string[] a = new string[6];
    int tot = 0;
    int totcount = 0;
protected void Page_Load(object sender, EventArgs e)
{
    if (Request.Cookies != null)
    {
        s = Convert.ToString(Request.Cookies["aa"].Value);
        string[] strarr = s.Split('|');
        for (int i = 0; i < strarr.Length; i++)
        {
            t = Convert.ToString(strarr[i].ToString());
            string[] strarr1 = t.Split(',');
            for (int j = 0; j < strarr1.Length; j++)
            {
                a[j] = strarr1[j].ToString();
            }
            tot = tot + (Convert.ToInt32(a[2].ToString()) + Convert.ToInt32(a[3].ToString()));
            totcount = totcount + 1;
            carttotitem.Text = totcount.ToString();
            carttotprice.Text = tot.ToString();
        }
    }
}
}
so What Should I do to Solve This Error
Please Help Me
 
     
    