Download Large data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?SHVzYW0=?=

    #1

    Download Large data

    Hi EveryBody:

    I have the following code to download the data from my web application:

    the code is:

    Dim rawan As New List(Of String) ' for File Name
    Dim rawan1 As New List(Of Byte()) ' for the data for each file
    Dim objconn As SqlConnection = New
    SqlConnection(C onfigurationMan ager.Connection Strings("Husam" ).ConnectionStr ing)
    Try
    Dim objcom As SqlCommand
    objcom = New SqlCommand("SEL ECT * FROM " + s, objconn)
    objconn.Open()
    Dim myread As SqlDataReader =
    objcom.ExecuteR eader(CommandBe havior.CloseCon nection)
    If myread.HasRows = True Then
    While myread.Read()
    rawan.Add(myrea d.GetValue(0))
    rawan1.Add(myre ad.GetValue(1))
    End While
    Me.Response.Bin aryWrite(rawan1 (ListBox1.Selec tedIndex))
    Dim husam As String = rawan(ListBox1. SelectedIndex)
    Response.AddHea der("Content-Disposition", "attachment ; filename=" + husam)
    End If
    myread.Close()
    objconn.Close()
    Catch ex As Exception
    Throw New Exception(ex.Me ssage)
    objconn.Close()
    End Try

    when I run this code to download small data like 4MB it works well,but when
    I use it to download large data for example let's say 345 MB there is an
    error occure that tell me the SystemOutOfMemo ry.

    I read about something called MaxResponseHead ersSize Property which I
    though it Like MaxRequestLengt h that I used before to make my application
    upload large data more than 4mb, but the requirments for this proprtey is
    windows 2003 or 2000 server side and windows xp clinte side.

    So is there some body can help me in this problem?

    any help or redirection will be apprediated

    regard's

    Husam
  • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

    #2
    RE: Download Large data

    the default is build the response in memory, then send it. with your large
    size, you runout of memeory (see machine.config for max memory size))

    if your response is this large you want to send it right away. turn page
    bufferring off. you will need to write the headers before content. use
    flush() to flush the buffers. also you will need to up the page timeout
    (default 1 minute), because a download of this size may takes minutes (about
    1 hour over dsl).

    -- bruce (sqlwork.com)


    "Husam" wrote:
    Hi EveryBody:
    >
    I have the following code to download the data from my web application:
    >
    the code is:
    >
    Dim rawan As New List(Of String) ' for File Name
    Dim rawan1 As New List(Of Byte()) ' for the data for each file
    Dim objconn As SqlConnection = New
    SqlConnection(C onfigurationMan ager.Connection Strings("Husam" ).ConnectionStr ing)
    Try
    Dim objcom As SqlCommand
    objcom = New SqlCommand("SEL ECT * FROM " + s, objconn)
    objconn.Open()
    Dim myread As SqlDataReader =
    objcom.ExecuteR eader(CommandBe havior.CloseCon nection)
    If myread.HasRows = True Then
    While myread.Read()
    rawan.Add(myrea d.GetValue(0))
    rawan1.Add(myre ad.GetValue(1))
    End While
    Me.Response.Bin aryWrite(rawan1 (ListBox1.Selec tedIndex))
    Dim husam As String = rawan(ListBox1. SelectedIndex)
    Response.AddHea der("Content-Disposition", "attachment ; filename=" + husam)
    End If
    myread.Close()
    objconn.Close()
    Catch ex As Exception
    Throw New Exception(ex.Me ssage)
    objconn.Close()
    End Try
    >
    when I run this code to download small data like 4MB it works well,but when
    I use it to download large data for example let's say 345 MB there is an
    error occure that tell me the SystemOutOfMemo ry.
    >
    I read about something called MaxResponseHead ersSize Property which I
    though it Like MaxRequestLengt h that I used before to make my application
    upload large data more than 4mb, but the requirments for this proprtey is
    windows 2003 or 2000 server side and windows xp clinte side.
    >
    So is there some body can help me in this problem?
    >
    any help or redirection will be apprediated
    >
    regard's
    >
    Husam

    Comment

    Working...