C# parsing cookie get null

This is my cookie value:


and that's my code:



 string email1 = Request.Cookies.Get("SolidDomain").Values.Get("email");
 string password2 = Request.Cookies.Get("SolidDomain").Values.Get("password");

in both cases I get null. what's wrong here?


You can have subkey cookie without problem but I think the string you gave us is not using subkey. In fact, the string you posted can be accessed directly with :


If you can to check to structure of the subkey you can use this snippet of code :

for(int i=0; i<Request.Cookies.Count; i++)
    aCookie = Request.Cookies[i];
    output.Append("Name = " + aCookie.Name + "<br />");
        for(int j=0; j<aCookie.Values.Count; j++)
            subkeyName = Server.HtmlEncode(aCookie.Values.AllKeys[j]);
            subkeyValue = Server.HtmlEncode(aCookie.Values[j]);
            output.Append("Subkey name = " + subkeyName + "<br />");
            output.Append("Subkey value = " + subkeyValue + 
                "<br /><br />");
        output.Append("Value = " + Server.HtmlEncode(aCookie.Value) +
            "<br /><br />");

And check the output variable to see Value and SubKey value.

If you want to allow cookie to a domain (I guess this is what you are trying to achieve) you can do it by using the domain property :

Response.Cookies["password"].Domain = "SolidDomain";

Need Your Help

Flash AS Event Properties: Possible to trace them with a for loop?

actionscript-3 events flash-cs4

I was wondering if it was possible to use a for (or for each) loop to trace the properties of an event to the output window. I know I can trace the event in one go, like this:

How do I save a floating-point number in 2 bytes?

c# binary floating-point ieee-754 numerical

Yes I'm aware of the IEEE-754 half-precision standard, and yes I'm aware of the work done in the field. Put very simply, I'm trying to save a simple floating point number (like 52.1, or 1.25) in ju...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.