Click here to Skip to main content
15,921,156 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Please give your valuable suggestions&answers and

thanks for responses.
Posted
Updated 28-Aug-12 20:15pm
v2

 
Share this answer
 
Comments
Mohamed Mitwalli 29-Aug-12 3:48am    
5+
Prasad_Kulkarni 29-Aug-12 5:00am    
Thank you Mohamed!
Manas Bhardwaj 30-Aug-12 14:13pm    
yup 5
Prasad_Kulkarni 30-Aug-12 23:53pm    
:) Thank you Manas!
Hi ,
Cookies a piece of data stored in the user's browser it can use on store Username & Password so user do not have to re-login to your website every time they visit , Cookies can keep information in the user's browser until deleted or Expired
Defaul1.aspx
C#
protected void Button1_Click(object sender, EventArgs e)
{
    HttpCookie Cookies = new HttpCookie("UserName");
    Cookies.Value = "your value";
    Cookies.Expires = DateTime.Now.AddMinutes(3);
    Response.Cookies.Add(Cookies);
    Response.Redirect("Default3.aspx");
}

Default3.aspx
C#
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        HttpCookie cookie = Request.Cookies["UserName"];
        if (cookie !=null)
        {
            Label1.Text = cookie.Value;
        }
    }
}


http://www.aspnettutorials.com/tutorials/network/cookies-csharp.aspx[^]
Cookies in ASP.NET[^]
all thing about cookies in asp.net c#[^]
http://msdn.microsoft.com/en-us/library/ms178194.aspx[^]
Best Regards
M.Mitwalli
 
Share this answer
 
v2
 
Share this answer
 
Comments
Nithin Sundar 29-Aug-12 2:16am    
He's posting too many questions like this. Instead he could have googled or atleast made a simple effort to enter all questions into one.
Sandeep Mewara 29-Aug-12 2:20am    
Yeah, suggested/told him when I saw the third one! Googled and gave links to state management techniques.
Here: http://www.codeproject.com/Answers/448930/What-is-ViewState-and-give-an-examples
bbirajdar 29-Aug-12 2:25am    
I think he has misunderstood codeproject as a free online software training/coaching centre, He is posting all the questions in the format - What is ****** and give examples...
Sandeep Mewara 29-Aug-12 2:50am    
Yep!
Mohamed Mitwalli 29-Aug-12 3:49am    
5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900