How to read cookies value on client side from server side code?

 I read an article which explains on how to read the client side cookies from C# code by doing something like:

//Grab the cookie
9: HttpCookie cookie = Request.Cookies[strCookieName];
I am very confused here. Server side code in on the server side, so how can a server side code read the cookies on the client machine?
I thought that only a client side script like Java Script  can read the client side cookies.
Kindly explain...please.


1/3/2008 4:20:39 PM 93655 articles. 6 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 48
Get it on Google Play
Get it on Apple App Store

Each time you request a page on a domain, the browser looks for a cookie for that domain on the client machine if it exists then it sends it with the request object. that is why you can Access it using the  Request.Cookies[cookiename].



Haissam Abdul Malak
| Blog |
1/3/2008 4:46:31 PM

so even if you don't request a cookie the browser will automatically send all the cookies to the server? i didn't know it something new or maybe i didn't know it.


1/3/2008 6:02:41 PM

By default, this is the browser behavior. When you request an application on a specific domain the browser will look on the client machine for specific cookies and send them to the web server.


Haissam Abdul Malak
| Blog |
1/3/2008 6:44:13 PM

thanks a lot for answering this. 

1/4/2008 2:10:30 PM

Similar Artilces:

How to get the Client side values in server side code.
Hi all, i have a proble i need to get the client side javascript values in C# code at server side. how can i pass those values? i am using version 1.1, i kno thatwe can use callback events mechnisam in 2.0 or ajax ,apart from that how we can pass? My problem is i need to stop the execution of the code based on after reciving values from the client   any ideas please???   Million thanks RamCheersRam MCP Hello Ram, a common approach is from javascript set an hidden field, then issue a postback. On the server-side, handle the post-back. Feel free to go deeper in your que...

How to take value from client side control from server side code?
Hi all, I would like to know that, how to access client side control in server side code? Here is an example.. I am having the textBox in client side like <input type="text" id="textBoxUsername" name="textBoxUsername"/> I need to take the value from this textBox in button click event which is server side code. private void buttonShow(object sender, System.EventArgs e) { //I need to access this textBox here. } How to do that? Thanks R. eswaran. hi you need to make it run at server. <input type="text" id="textBoxUsername"...

Client side code to pass values to server side variable?
Hi there, I have ListBox_SelectedTextChanged() method that creates another list box in the runtime as follows: // Get Action Level List lbxActionLevel = new ListBox();lbxActionLevel.ID = "ddlA" + i.ToString(); lbxActionLevel.Width = 100; lbxActionLevel.Rows = 2;SqlDataReader dr = new BusinessLogicLayer().bllGetActionLevels(); lbxActionLevel.Items.Clear();while (dr.Read()) {ListItem lAction = new ListItem(); lAction.Text = dr.GetString(1).Trim();lAction.Value = Convert.ToString(dr.GetInt32(0)); lbxActionLevel.Items.Add(lAction); lbxActionLevel.SelectedIndex = 0; } I ...

client side code & server side code
what is the difference between client side coding & server side coding ? when to use client side & server side code? Client side code runs on the user's browser and includes languages such as javascript and vbscript. Server side code runs on the web server and can be written in languages such as ASP.NET, PHP, ASP, ColdFusion etc. Website Design Darlington - - Experts, Information, Ideas & Knowledge - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer...

Atlas client side control value available to server side C# code behind
I have an existing ASP.NET application. The page contains a datagrid (asp:datagrid). In my current C# code behind, I fetch data from SQL Server 2005 and bind to the datagrid when a button is selected (Click event). There can be many entires in the grid however, so the user typically enters text in a textbox as a filter on the returned results from SQL Server 2005. Now after studying an Atlas sample animalservice, with an HTML suggestion text box, I would like to use client-side Atlas to give the user a better indication of...

How can I set client side values as server side values?
Hi, Can anyone tell me how I can get client side values such as document.referrer, navigator.appName etc... into server side scripts? There are some client side values I'd like to set as session vars and insert into the db? How do I go about this? Thanks for any pointers Davlon PS (I'm using powersite Pass them as page parameters, e.g., http://myserver/myurl?document.referrer=whatever&navigator.appName=yadayada Then, in your server-side script, just loop through the document.value array and get these values. -- pbm_hopethishelps, Roy Kie...

Client-side values to server-side ?
Hi! My previous query is attached below: I have implemented the below mentioned implementation . 'listbox1' on 'webform1' shows all the values from 'webform2'. I have implemented it using javascript. I would like to know that to implement validation on 'webform1', I would require the values of 'listbox1' ,which are on the client-side , to move to the server-side . I think sending a querystring will be fine but how to implement it using javascript and code-behind(C#)? Your suggestion will be appreciated. Thanks and regards, ap.       My previous query: " I am stuck wi...

client side and server side code
Making things clear:When creating a web application one must know the difference between client side code and server side code.client side code is the code that is executed on the computer of the user. server side code is the code that is executed on the ....server.why is there client side code and server side code?well... server side code exist for the reason of sharing data with multiple users. for example: accessing a database.ASP.NET is a server side technology. in you can use different languages such as VB.NET or C#.client side code is used to perform tasks on the computer of th...

Client Side values to Server Side
What is the best way to transfer Client Side values to the Server side? For example I have a variable "var1" in javascript. var1 = "sample"; How can I acquire this value in the server side?  What is the best approach for this?  Barry to send the value to the server during a postback, you need to place the value in an input control.  You could consider using a hidden textbox for that purpose.Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: In the JavaScrip...

How to Access/Pass Server Side Array Variable at Another Web Form's Client Side
Hi All,I struck up with some intrested senario at my application development...hope some body will guide me or sends me some code snippets....Thanks in advance.Senario is like A.aspx (using C# .net 2.0 as code behind) I am going to have a array variable basically it is an TWO Dimensional array after populating the values in array I need to redirect/ reload another web form B.aspx, here i need to access the array in B.aspx client side JavaScript.How can I do this...Thanks AgainRaju Dont do a redirect but use server.transfer. That way the previous page will still hold its value, ...

How to pass the client side values to server side?
 hello to All,Actually i wanna implement a code like... a string in HTML textbox retrieve in server side control....suppose i hv a HTML control <input type="text" id="txtHTML"/>, and dis control  txtHTML.text="abc".now i want to retrieve dis client side string "abc" in d server side textbox named "txtASP"...which hs a property runat="server"so please give me an idea how to pass values from client side to server side.... hope u understand a problem... sam.  You could do this <input type="text"...

Calling server-side code from client-side
Hi,  I´m implementing some shortcut functionality in my web forms and wanna know where i can find something that explains, for example, how to call the handler event "onclick" of a button. I´m using this library to add shortcuts to my controls:   And I want to "link" some key combination for the event handlers of the controls. Does anybody knows?  Thanks. You could attach an AJAX event to the Javascript shortcut event handler so, for example, the shortcut function will trigger a button cl...

Client side to execute server side code
I am maintaining an ASP.NET C# application written by someone else.  I am essentially a newbie to web development especially client side stuff.  Based on reading these forums I understand that I can't directly call a server side method from the client side and I have to use post pack in some way (using a webservice is not an option here).  My confusion comes from the HTML setup being used.The page has three frames; a header, body and footer.  Each frame is filled by it's own ASPX page.  The footer contains buttons for navigating to another page and some of the b...

Execute the client side and server side code
Hi, Hi, I have two drop down lists one ddl1, ddl2. when ddl1 index is changed I have to change the label before the ddl1 and contents of ddl2. 1) to change the label before ddl2, I am using the javascript like this:ddl1.Attributes.Add("onchange", "changeLabelText(this); return false;"); Javascript function<script language="javascript"> function changeLabelText(ddl) { var indx = ddl.selectedIndex; var lbl = document.getElementById('<%= lblSelect.ClientID %>'); if(indx == 0) lbl.innerHTML = "Select A:"; if(indx == 1)lbl.i...

Web resources about - How to read cookies value on client side from server side code? -

Fortune cookie - Wikipedia, the free encyclopedia
A fortune cookie is a crisp cookie usually made from flour , sugar , vanilla , and sesame seed oil with a "fortune" wrapped inside. A "fortune" ...

With Facebook Exchange, Company Changes Stance On Cookies
... for as the company tries to boost revenue. While you’re probably growing used to that, it represents a change in Facebook’s stance toward cookies ...

Tastemade - Cookie the News: David Bowie - Facebook
"I don't know where I'm going from here, but I promise it won't be boring." - David Bowie, 1947-2016

Slideshow: Facebook’s top games of 2014 — Cookie Jam, Kim Kardashian and more
Facebook on Tuesday announced the games of the year , with SGN’s Cookie Jam taking the top honor. Kim Kardashian’s game , as well as titles featuring ...

Crumblin' Cookie (@Crumblin_Cookie) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Male Girl Scout has trouble selling cookies in drag
... is transgender, started knocking on neighbors' doors near her home in Herrin, Ill., one man turned her away, saying: "Nobody wants to buy cookies ...

iOS cookie theft bug allowed hackers to impersonate users
... operating system that made it possible for hackers to impersonate end users who connect to websites that use unencrypted authentication cookies. ...

Dark Chocolate Truffle Cookies
... pink eye that made it impossible to have enough screen time. Lucky for me, I had made an amazing batch of these dark chocolate truffle cookies ...

EZTV & Nic Hessler cover Milk 'N' Cookies for RSD16 7" (listen), opening for Martin Courtney on upcoming ...
... Pearis Captured Tracks labelmates EZTV and Nic Hessler have collaborated on a cover of "Buy This Record" by powerpop cult heroes Milk 'N' Cookies ...

Resources last updated: 2/11/2016 1:02:36 AM