Click here to Skip to main content
15,912,897 members
Home / Discussions / C#
   

C#

 
Questionhow i can find what are objects used in a .cs file Pin
senselva8-May-07 19:51
senselva8-May-07 19:51 
AnswerRe: how i can find what are objects used in a .cs file Pin
urbane.tiger8-May-07 21:15
urbane.tiger8-May-07 21:15 
AnswerRe: how i can find what are objects used in a .cs file Pin
Christian Graus8-May-07 21:18
protectorChristian Graus8-May-07 21:18 
Questionhow to do online registration Pin
fgfdhghgfd8-May-07 19:46
fgfdhghgfd8-May-07 19:46 
AnswerRe: how to do online registration Pin
AFSEKI8-May-07 22:49
AFSEKI8-May-07 22:49 
AnswerRe: how to do online registration Pin
Muammar©8-May-07 22:51
Muammar©8-May-07 22:51 
QuestionEstablished connection aborted by the software in host machine Pin
SakthiSurya8-May-07 19:27
SakthiSurya8-May-07 19:27 
QuestionBytes to be written to the stream exceed the Content-Length bytes size specified. Pin
nasambur8-May-07 19:04
nasambur8-May-07 19:04 
Hi..

I'm trying to upload a image file to the server using HttpWebRequest/HttpWebResponse.
so i form a Postdata as and storing in a StringBuilder object (sbFormData)..

Content-Type: multipart/form-data; boundary=AaB03x

   --AaB03x
   Content-Disposition: form-data; name="submit-name"

   Larry
   --AaB03x
   Content-Disposition: form-data; name="files"
   Content-Type: multipart/mixed; boundary=BbC04y

   --BbC04y
   Content-Disposition: file; filename="file1.txt"
   Content-Type: text/plain

   ... contents of file1.txt ...
   --BbC04y
   Content-Disposition: file; filename="file2.gif"
   Content-Type: image/gif
   Content-Transfer-Encoding: binary

   ...contents of file2.gif...
   --BbC04y--
   --AaB03x--


while adding the image content i read byte by byte and then adding to the sbFormData.

But when i see the sbFormdata's length its not showing exact length. That is not adding the image content's length.

Then setting the HttpWebRequest.Length to sbFormdata.Length..
httpWebRequest.ContentLength = sbFormData.Length;

after when i try to write the sbFormData to the httpWebRequest.GetRequestStream(), i get

Error:

"Bytes to be written to the stream exceed the Content-Length bytes size specified."

try
{
  StreamWriter s = new StreamWriter(httpWebRequest.GetRequestStream());
  s.Write(sbFormData.ToString());        
  s.Close();
}
catch (Exception e)
{
  Debug.Print("Error in sending data " + e.Message);
}


Please help me..

regards,
nas
AnswerRe: Bytes to be written to the stream exceed the Content-Length bytes size specified. Pin
Guffa8-May-07 20:50
Guffa8-May-07 20:50 
GeneralRe: Bytes to be written to the stream exceed the Content-Length bytes size specified. Pin
nasambur8-May-07 20:55
nasambur8-May-07 20:55 
Questioncrystal report using a stored procedure which requires a parameter Pin
rkherath8-May-07 17:03
rkherath8-May-07 17:03 
Questionhow to create an autoincrement id [modified] Pin
balanjingot8-May-07 16:33
balanjingot8-May-07 16:33 
Questionaccess to objectdatasource ondeleting value Pin
wongton8-May-07 16:09
wongton8-May-07 16:09 
QuestionProblem reading XML Pin
Mark F.8-May-07 14:49
Mark F.8-May-07 14:49 
AnswerRe: Problem reading XML Pin
Christian Graus8-May-07 16:55
protectorChristian Graus8-May-07 16:55 
GeneralRe: Problem reading XML Pin
Mark F.9-May-07 4:02
Mark F.9-May-07 4:02 
AnswerRe: Problem reading XML Pin
AFSEKI8-May-07 23:01
AFSEKI8-May-07 23:01 
QuestionReading a text file into a textBox Pin
simplicitylabs8-May-07 13:42
simplicitylabs8-May-07 13:42 
AnswerRe: Reading a text file into a textBox Pin
xibeifeijian8-May-07 14:34
xibeifeijian8-May-07 14:34 
GeneralRe: Reading a text file into a textBox Pin
simplicitylabs8-May-07 14:55
simplicitylabs8-May-07 14:55 
GeneralRe: Reading a text file into a textBox Pin
Dave Kreskowiak8-May-07 17:33
mveDave Kreskowiak8-May-07 17:33 
GeneralRe: Reading a text file into a textBox Pin
simplicitylabs8-May-07 18:22
simplicitylabs8-May-07 18:22 
GeneralRe: Reading a text file into a textBox Pin
xibeifeijian9-May-07 3:13
xibeifeijian9-May-07 3:13 
AnswerRe: Reading a text file into a textBox Pin
Christian Graus8-May-07 18:25
protectorChristian Graus8-May-07 18:25 
GeneralRe: Reading a text file into a textBox Pin
simplicitylabs8-May-07 18:38
simplicitylabs8-May-07 18:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.