you should use session instead of cookies or query string Session is stored on server side and more secure than both,
You can define it in this manner
Session["UserID"]="123";
//what ever you like to store
you can use it in this way
int sessionID = Convert.ToInt32(Session["UserID"]);
string sessionID1 = Convert.ToString(Session["UserID"]);