Autor Beitrag
DennisXX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 133



BeitragVerfasst: Mo 31.10.11 13:17 
Hallo
Hallo !

Kann mir vielelicht jemand sagen, wo hier mein Fehler ist? Ich möchte einen Cookie dynamisch über eine For-Schleife auslesen (in diesme Fall die zweite For-Schleife), aber die zweite For Schleife wird nie durchlaufen. Wie kann die Anzahl an Cookie Values / Cookie Felder in den Kopf der For-Schleife einbauen?

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
void auslesenCookie()
        {
            HttpCookie cookie;
            System.Collections.Specialized.NameValueCollection nvcCookieValues;
            string strCookieValue;
            string strAusgabewertCookie;

            for(int i = 0; i < Response.Cookies.Count; i++)
            { 
                cookie = Request.Cookies[i];

                if(cookie.HasKeys){

                    nvcCookieValues = cookie.Values;
                    
                    for(int j = 0; j < nvcCookieValues.Count; j++)
                    {
                        strCookieValue = "cookiewert_" + j;
                        strAusgabewertCookie = Response.Cookies[strCookieValue].Value;
                    }
                }
            }
        }
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mo 31.10.11 13:44 
Hallo Dennis,

kann es sein, daß du mit "Request" und "Response" durcheinandergekommen bist:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
for(int i = 0; i < Response.Cookies.Count; i++)
{
    cookie = Request.Cookies[i];

    // ...
}

?