Hi,

I have these two - almost identical http posts, one works, other doesn't.

POST /debug/kktest.ashx HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------8cf186fa8ac7b31
Host: 172.16.0.9:7777
Content-Length: 68004
Expect: 100-continue
Connection: Keep-Alive

-----------------------------8cf186fa8ac7b31
Content-Disposition: form-data; name="identu"

2
-----------------------------8cf186fa8ac7b31
Content-Disposition: form-data; name="bookingno"

aaaaa
-----------------------------8cf186fa8ac7b31
Content-Disposition: form-data; name="tag"


-----------------------------8cf186fa8ac7b31
Content-Disposition: form-data; name="file"; filename="aaa"
Content-Type: x-application/pdf

binary data here

and the second one

POST http://localhost/debug/kktest.ashx HTTP/1.1
Accept: */*
Accept-Language: en-US
Content-Length: 561722
Content-Type: multipart/form-data; boundary=---------------------------8cf186fcee2be74
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: localhost
Connection: Keep-Alive
Pragma: no-cache
Cookie: .ASPXAUTH=05E2D927B666FAE3A2E10E60910EF4280EC803F8CE0DDCD65410A371C118FA04C3F1F0CF3E4E2497699AD21DEB1317599F72AEC423E4AEB9AC6A5E123BDADA5662AB1848BE8B9FD6CB0EC52C6F879F73E5188A9A6F3243DE47D5E727C6D0B608572F9B141BDF618332B8C02B984F332F007C46D06263BF19A9470296B76379D9BC4C8979E18DDEC2093C43BEAD0C16818D9883870CE70B8579D301517907639BFEEB2E1DDB1933AC996BDD00728A36FEB0CDBF1F6D3C39EBF984C8FDF4301FA5

---------------------------8cf186fcee2be74
Content-Disposition: form-data; name="identu"

43
---------------------------8cf186fcee2be74
Content-Disposition: form-data; name="bookingno"

10000000
---------------------------8cf186fcee2be74
Content-Disposition: form-data; name="tag"


---------------------------8cf186fcee2be74
Content-Disposition: form-data; name="file"; filename="Lighthouse.jpg"
Content-Type: x-application/jpg

binary data here

Request.Files.Count is 1 and 0, any idea what is wrong ?

Assuming that the 2nd example is the broken one...

  1. Change the host in the first example to localhost and make sure it still works and therefore eliminate hosting differences.
  2. Verify your typing - make sure of things like the filename being "Lighthouse" and not "lighthouse" etc.
  3. Remove the extra bits that aren't in the first example (Accept-Language etc.) and make sure it works without them.
  4. Add the extras back ONE AT A TIME until it breaks and cure THAT problem before proceeding.
  5. Repeat step 4 until you have replaced all the extras removed in step 3.
This article has been dead for over six months. Start a new discussion instead.