---
title: "How to create multiple cookies in mvc4?"  
description: "How to create multiple cookies in mvc4?"  
author: "Ganesh Kumar"  
published: 2015-09-09  
updated: 2015-09-09  
canonical: https://www.mindstick.com/forum/33450/how-to-create-multiple-cookies-in-mvc4  
category: ".net"  
tags: ["mvc4"]  
reading_time: 1 minute  

---

# How to create multiple cookies in mvc4?

How to create new [cookie](https://www.mindstick.com/blog/123/what-is-cookie-poisoning) if the cookie is [already](https://yourviews.mindstick.com/view/88453/the-hidden-ways-ai-is-already-controlling-your-daily-life) create for same [application](https://www.mindstick.com/articles/12824/calculator-application-in-android)?\
[Scenario](https://yourviews.mindstick.com/view/81221/sports-will-change-the-education-scenario): I have fetched the [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) and [stored](https://www.mindstick.com/forum/157561/what-is-the-stored-procedure-create-a-procedure-to-find-the-record-by-stu_id-from-the-student-table) into session then cookie has created with [session id](https://www.mindstick.com/forum/2152/recreate-a-session-by-using-your-session-id).[second](https://answers.mindstick.com/qa/41761/how-did-the-second-industrial-revolution-influence-women-s-roles-in-society) time i want to maintain different data in another cookie is it possible in mvc4?

## Replies

### Reply by Anonymous User

Hi Ganesh\
To write and read a single cookie with multiple key/values, it would look something like this:\

```
HttpCookie cookie = new HttpCookie("mybigcookie");cookie.Values.Add("name", name);cookie.Values.Add("address", address);//get the values outstring name = Request.Cookies["mybigcookie"]["name"];string address = Request.Cookies["mybigcookie"]["address"];
```


---

Original Source: https://www.mindstick.com/forum/33450/how-to-create-multiple-cookies-in-mvc4

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
