First add USING SYSTEM.WEB.SESSIONSTATE reference.
This time you send information:
HttpCookie cookie = new HttpCookie ( "UserCookie"); cookie.Values.Add ( "UserName", tbName.Text); cookie.Values.Add ( "UserPassword", tbPassword.Value.ToString ()); cookie.Values.Add ("Userrole", DS.Tables ["Users"]. Rows [0] ["role"]. TOSTRING ()); response.Appendcookie (cookie); response.redirect ("mainpage.aspx");
This accepts information:
String Sname = Request.cookies ["usercookie"]. values ["UserName"]. TOSTRING (); string snrole = request.cookies ["usercookie"]. Values ["userrole"]. Tostring ();