Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Cookies in .NET

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 41
    Comment on it

    Cookies are used to store the credentials and providing and remembering it whenever needed.


    Cookies are on both side client side as well as on server side.


    Types of Cookies:


    Persistent


    Non-persistent


    Persistent cookies exists till their life time expires


    Non-persistent cookies dont have expiry time associated with it . It expires as soon as the browser or window is closed


    Creating Cookies


    //Creting a Cookie Object
    HttpCookie userInfoCookies = new HttpCookie("UserInfo");
    
    //Setting values inside it
    userInfoCookies["UserName"] = "Abhijit";
    userInfoCookies["UserColor"] = "Red";
    userInfoCookies["Expire"] = "5 Days";
    
    //Adding Expire Time of cookies
     userInfoCookies.Expires = DateTime.Now.AddDays(5);
    
    //Adding cookies to current web response
    Response.Cookies.Add(userInfoCookies); 
    
    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: