none
Problem uploading files over 4MB in windows application RRS feed

  • Question

  • Hi,

    When I upload xml file over 4 MB over the internet, it gives an error.

    I'm not using any app and machine config file in my windows application. 

    I'm using .net framework 4.0 and c# language.

    I've tried following code-

    byte[] buffer = new byte[fileData.Length];         //fileData is a stream object

    webrequest.ContentLength = buffer.Length;

    But it is not working for the file which have more than 4 mb size.

    Thanks,

    Saurabh 

    Monday, August 12, 2013 4:49 PM

Answers

  • Hello,

    Thanks for your question.

    Based on my experience ,generally, it should be caused because when  you upload file, the request times out. To narrow down this issue , you can check HttpWebRequest.Timeout   setting .

    If this issue cannot be solved, to troubleshoot this issue, please help to confirm the following things:

    1)Please try to change a local network to upload file again if you have and see if the same issue will occur, which can help us to determine if it is caused by httpWebRequest.timeout.

    2)Please let me know the detailed steps to reproduce the issue, and it will be better if you can provide a sample project.

    3)Please let me what's  the error information  .

    In addition, we can also try to debug the application and use try –catch block on your machine to see if we can find any more information and problematic code  for this issue. If you can find any interest code, please post the code here.

    I understand that  it will take some time to perform above actions, but it will be very helpful for us to solve this issue.

    Thanks for your cooperation.


    Lilia Gong <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, September 4, 2013 7:54 AM
    Moderator
  • Try increasing the value of maxRequestLength in Web.config: http://support.microsoft.com/?id=295626

    Wednesday, September 4, 2013 7:18 PM

All replies

  • Hi Saurabh,

    WebRequest is part of System.Net class and we in VSTA donot deal with this. I am moving this thread to ".NET Class Libraries" forums.

    Thanks,

    Gaurav

    Saturday, August 24, 2013 6:37 PM
  • Hello,

    Thanks for your question.

    Based on my experience ,generally, it should be caused because when  you upload file, the request times out. To narrow down this issue , you can check HttpWebRequest.Timeout   setting .

    If this issue cannot be solved, to troubleshoot this issue, please help to confirm the following things:

    1)Please try to change a local network to upload file again if you have and see if the same issue will occur, which can help us to determine if it is caused by httpWebRequest.timeout.

    2)Please let me know the detailed steps to reproduce the issue, and it will be better if you can provide a sample project.

    3)Please let me what's  the error information  .

    In addition, we can also try to debug the application and use try –catch block on your machine to see if we can find any more information and problematic code  for this issue. If you can find any interest code, please post the code here.

    I understand that  it will take some time to perform above actions, but it will be very helpful for us to solve this issue.

    Thanks for your cooperation.


    Lilia Gong <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, September 4, 2013 7:54 AM
    Moderator
  • Try increasing the value of maxRequestLength in Web.config: http://support.microsoft.com/?id=295626

    Wednesday, September 4, 2013 7:18 PM