www.webdeveloper.com
Results 1 to 2 of 2

Thread: asp.net cookies

  1. #1
    Join Date
    Jul 2007
    Posts
    13

    asp.net cookies

    Hi,
    i want to use cookies to store the language.
    i explain, i use asp.net(VB), i have the start page where there is only two button to choose the language(English or Frensh) after that i redirect to the welcome page what i want is when a user choose a language for exemple english the cookie take this value and next time when the same user go to to the web site he hasn't to choose the language he the welcome page will be displayed automatically with the last choosen language(english as exemple).
    can you help me, i don't know how to do this?
    thanks in advance.
    devsa

  2. #2
    Join Date
    Jun 2006
    Posts
    384
    To set a cookie:

    PHP Code:
    HttpCookie ck = new HttpCookie("Language""French");
    ck.Expires DateTime.Now.AddDays(60);
    Response.Cookies.Add(ck); 
    To Get the value :

    PHP Code:
    string Lang "English";//Default to English
    if (Request.Cookies["Language"] != null)
           
    Lang Request.Cookies["Language"].Value 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles