Please consider this code:

			RHTTPResponse resp1 = aTransaction.Response();
			RStringPool strP = aTransaction.Session().StringPool();
			RHTTPHeaders hdr = resp1.GetHeaderCollection();
			THTTPHdrFieldIter it = hdr.Fields();
			TBuf<512> fieldName16;
			TBuf<512> fieldVal16;

			while (it.AtEnd() == EFalse)
				// Get the name of the next header field <br>
				RStringTokenF fieldName = it();
				RStringF fieldNameStr = strP.StringF(fieldName);

				// Check it does indeed exist
				THTTPHdrVal fieldVal;
				if (hdr.GetField(fieldNameStr, 0, fieldVal) == KErrNone)
					RStringF wwwCookie = strP.StringF(HTTP::ESetCookie,	RHTTPSession::GetTable());
					TInt mycookieCount = hdr.FieldPartsL(wwwCookie);

					if (fieldNameStr == wwwCookie)
						RStringF nameValStr;
						RStringF valueValStr;

						// Check the cookie name and value
						RStringF name = strP.StringF(HTTP::ECookieName,	RHTTPSession::GetTable());
						RStringF value = strP.StringF(HTTP::ECookieValue, RHTTPSession::GetTable());

						THTTPHdrVal nameVal, valueVal;
						if (hdr.GetParam(wwwCookie, name, nameVal) == KErrNone)
							nameValStr = strP.StringF(nameVal.StrF());
						if (hdr.GetParam(wwwCookie, value, valueVal) == KErrNone)
							valueValStr = strP.StringF(valueVal.StrF());

						// Create a cookie object with name, value and URI and save
						// it as a file (for example, to app. private directory)
						// URI can be obtained with:						
						 //const TUriC8& requestUri = aTransaction.Request().URI();
				// Advance the iterator
I am using this code to read incoming cookies. The application crashes at the pointed line. No idea what is going wrong in here.

Please suggest.