0

I was wondering is it possible that controllers action method take jquery cookie as param, something like this:

First i create a cookie with jquery like this:

$.cookie('SomeID', 1);


And then in controller i check for this value, something like:

public ActionResult Index(int? SomeID)
{
   if(SomeID != null)
   {
        // Do something...
   }
   else
   {
        // Do something else...
   }
}


This is not working for me to be honest...Tried using HttpCookie as type as well but still no luck...Any suggestions?

Ah yes, forgot to mention if i do something like this in my controller action method, im able to get cookies value.

 var id = Request.Cookies["SomeID"].Value;


Thanks in advance!

Exerlol
  • 241
  • 3
  • 14

0 Answers0