Getting issue while downloading 4 to 5 gb file from blob storage.

Hi i have to download a file from blob storage upto 3 to 5 gb .
Below is my code:
Label lblfilename = (Label)row.FindControl("lblGrid_filename");
    Label lblfilesize = (Label)row.FindControl("lblGrid_hidfileSize");
    string downloadfile = lblfilename.Text.ToString();
   // DownloadFileFromBlob(downloadfile, CONTAINER, ACCOUNTKEY);
    AccountFileTransfer = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=" + ACCOUNTNAME + ";AccountKey=" + ACCOUNTKEY);
    if (AccountFileTransfer != null)
        BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
        ContainerFileTransfer = BlobClientFileTransfer.GetContainerReference(CONTAINER);
        ContainerFileTransfer.CreateIfNotExist();
        BlobRequestOptions options = new BlobRequestOptions();
        options.Timeout = new TimeSpan(0, 180, 0);
    var data = Regex.Match(lblfilesize.Text.ToString(), @"\d+").Value;
    int value32;
    Int64 value64;
    var blobSize = 0L;
    var blockSize = 0L;
    var offset = 0L;
    if (int.TryParse(data, out value32))
        blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
    else if (Int64.TryParse(data, out value64))
        blobSize = Convert.ToInt64(lblfilesize.Text.ToString());
    var blob = ContainerFileTransfer.GetBlockBlobReference(downloadfile);
    var sasUrl = blob.Uri.AbsoluteUri;
    CloudBlockBlob blockBlob = new CloudBlockBlob(sasUrl);
    //blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
    blockSize = 5 * 1024 * 1024;
    Response.Clear();
    Response.ContentType = "APPLICATION/OCTET-STREAM";
    System.String disHeader = "Attachment; Filename=\"" + blockBlob.Name + "\"";
    //Response.AppendHeader("Content-Disposition", disHeader);
    for (offset = 0; offset < blobSize; offset += blockSize)
        using (var blobStream = blockBlob.OpenRead())
            if ((offset + blockSize) > blobSize)
                blockSize = (blobSize - offset);
            byte[] buffer = new byte[blockSize];
            blobStream.Read(buffer, 0, buffer.Length);
            Response.BinaryWrite(buffer);
            Response.Flush();
    Response.End();
SNAPSHOT of error:
Pawan

Hi Will thanks per the reply
I have make some changes in the code and now i am using the v4.0.30319 azure storage for downloading and able to download a file upto 3.5 GB. Now the problem is that each file size is showing 0 KB.
Here is my code and snapshot:
  Button btndownloadrow = (Button)sender;
    GridViewRow row = (GridViewRow)btndownloadrow.NamingContainer;
    Label lblfilename = (Label)row.FindControl("lblGrid_filename");
    Label lblfilesize = (Label)row.FindControl("lblGrid_hidfileSize");
    string downloadfile = lblfilename.Text.ToString();
    CloudStorageAccount AccountFileTransfer = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=" + ACCOUNTNAME + ";AccountKey=" + ACCOUNTKEY);
    // Create the blob client.
    CloudBlobClient BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
    // Retrieve reference to a previously created container.
    CloudBlobContainer ContainerFileTransfer = BlobClientFileTransfer.GetContainerReference("filetransfer");
    if (AccountFileTransfer != null)
        BlobClientFileTransfer = AccountFileTransfer.CreateCloudBlobClient();
        CloudBlockBlob pageBlob = ContainerFileTransfer.GetBlockBlobReference(CONTAINER);
        ContainerFileTransfer.CreateIfNotExists();
        BlobRequestOptions options = new BlobRequestOptions();
        options.ServerTimeout= new TimeSpan(0, 180, 0);
    var data = Regex.Match(lblfilesize.Text.ToString(), @"\d+").Value;
    int value32;
    Int64 value64;
    var blobSize = 0L;
    var blockSize = 0L;
    var offset = 0L;
    if (int.TryParse(data, out value32))
        blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
    else if (Int64.TryParse(data, out value64))
        blobSize = Convert.ToInt64(lblfilesize.Text.ToString());
    CloudBlockBlob blob = ContainerFileTransfer.GetBlockBlobReference(downloadfile);
    var sasUrl = blob.Uri;
    CloudBlockBlob blockBlob = new CloudBlockBlob(sasUrl);
    //blobSize = Convert.ToInt32(lblfilesize.Text.ToString());
    blockSize = 4 * 1024 * 1024;
    Response.Clear();
    Response.ContentType = "APPLICATION/OCTET-STREAM";
    System.String disHeader = "Attachment; Filename=\"" + blockBlob.Name + "\"";
    Response.AppendHeader("Content-Disposition", disHeader);
   // blob.DownloadToStream(Response.OutputStream);
   // byte[] bytes = new byte[blockSize];
    for (offset = 0; offset < blobSize; offset += blockSize)
        using (var blobStream = blockBlob.OpenRead())
            if ((offset + blockSize) > blobSize)
                blockSize = (blobSize - offset);
        byte[] buffer = new byte[blockSize];
            blobStream.Read(buffer, 0, buffer.Length);
            Response.BinaryWrite(buffer);
            Response.Flush();
    Response.End();
SNAPSOT:
Please suggest me if i am missing any logic.
Pawan

Similar Messages

  • HT201272 Had some wifi issues while downloading an album. First 3 tracks... sound stops way early but continues the count. How can I tell iTunes to redo the first 3?

    Had some wifi issues while downloading an album. First 3 tracks... sound stops way early but continues the count. How can I tell iTunes to redo the first 3? Any way to just fix it?

    Hey davma1
    All you need to delete the songs then go through the process of downloading the past purchase again.
    Deleting files from the iTunes library and your computer
    http://support.apple.com/kb/ht3842
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    http://support.apple.com/kb/HT2519
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • I am getting dump while downloading

    i am getting dump while downloading file  to presentaion server .
    please suggest me .
    code is like below.
    PARAMETERS : p_dwn   TYPE dxfile-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dwn.
        CALL FUNCTION 'F4_FILENAME'
      EXPORTING
        PROGRAM_NAME        =
        DYNPRO_NUMBER      =
        FIELD_NAME                =
           IMPORTING
             file_name           = p_dwn.
        CALL FUNCTION 'GUI_DOWNLOAD'
             EXPORTING
                  filename              = p_dwn
                  filetype              = 'ASC'
                  write_field_separator = 'X'
             TABLES
                  data_tab              = t_zvtpmheader.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.

    Hi Veeru,
    This dump you are getting because of type mismatch, just change the file path as follows :-
    data declaration should be like this.
    PARAMETERS : p_dwn TYPE STRING. <<<----
    it will surely work.
    cheers
    Dhirendra

  • Getting issue while publishing the app studio

    getting issue while publishing the app studio 
    error reported is The installable package was not created because the code generation failed.

     touchdevelop qcxhb
    & Jumping Lion is the name of the app. 
    is this the information you are looking 
    in source code it is showing the error as 
    Error downloading TouchDevelop package for script id 'qcxhb'. Reason: Errors in gamepad->game
    not sure if this can help 

  • How to set my computer settings to download excel and acrobat files from website

    How do I adjust settings to download acrobat and excel files from website.  I've already run a
    diagnostic on my security program and it is not a security issue. 

    You may have forgotten to post some information, but I fail to see in which way your question is related with Adobe Reader.

  • Where can I download Tuxedo 10.3 files from?

    Where can I download Tuxedo 10.3 files from? The OTN download page only has Tuxedo 11 and 12.

    Hi Tom,
    I believe you need to contact Oracle Support to get older versions of Tuxedo.
    Regards,
    Todd Little
    Oracle Tuxedo Chief Architect

  • Getting NameNotFoundException while trying to look up timer from startup cl

    Hi all,
    I am getting NameNotFoundException while trying to look up timer from startup class.
    I have configured commonj.timers.TimerManager in ejb-jar.xml of my MDB. I am using statrtup classes to initialize some static components immidiate to the MDB's active state. I have to initialize the timer manager object immidiate to the MDB's active state which is configured in ejb-jar.xml. I wrote this lookup logic in postStart() method of ApplicationLifecycleListener, The method getting called but the lookup logic getting failed, the same look up logic is working in MDB class (MDBTimer.java). I have tried different ways, I did’nt get solution, finally I am posting the problem here.
    Could any of weblogic experts please help out on this Issue?
    Here I am giving my code.
    weblogic-application.xml
    <?xml version='1.0' encoding='UTF-8'?>
    <weblogic-application
         xmlns="http://www.bea.com/ns/weblogic/weblogic-application" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd">
         <listener>
              <listener-class>my.examples.mdb.timer.TestApplicationListener</listener-class>
         </listener>     
    </weblogic-application>
    ejb-jar.xml
              <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
              http://java.sun.com/xml/ns/j2ee/ejb-jar_3_0.xsd"
                   version="3.0">
                   <enterprise-beans>
                        <message-driven>
                             <ejb-name>MyTimerMDB</ejb-name>
                             <ejb-class>my.examples.mdb.timer.MDBTimer
                             </ejb-class>
                             <resource-ref>
                                  <description>My Default Timer Manager</description>
                                  <res-ref-name>timer/MyDefaultTimer</res-ref-name>
                                  <res-type>commonj.timers.TimerManager</res-type>
                                  <res-auth>Container</res-auth>
                                  <res-sharing-scope>Unshareable</res-sharing-scope>
                             </resource-ref>
                        </message-driven>
                   </enterprise-beans>
              </ejb-jar>
    MDBTimer.java
    package my.examples.mdb.timer;
    import javax.ejb.MessageDriven;
    import javax.ejb.TransactionAttribute;
    import javax.ejb.TransactionAttributeType;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    import javax.jms.ObjectMessage;
    import commonj.timers.Timer;
    import commonj.timers.TimerManager;
    @MessageDriven(mappedName = "TEST_Q", name = "MyTimerMDB", activationConfig = {
              @javax.ejb.ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
              @javax.ejb.ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
              @javax.ejb.ActivationConfigProperty(propertyName = "transactionType", propertyValue = "Container"), })
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public class MDBTimer implements MessageListener {
         public static TimerManager manager = null;
         @Override
         public void onMessage(Message arg0) {
              System.out.println("onMessage() method called...\n\n");
              if (arg0 instanceof ObjectMessage) {
                   ObjectMessage msg = (ObjectMessage) arg0;
                   try {
                        if (msg.getObject() instanceof String) {
                             Thread.sleep(1000);
                             System.out
                                       .println("Message received >> " + msg.getObject());
                   } catch (Exception e) {
                        e.printStackTrace();
              System.out.println("onMessage() method returned...\n\n");
              if(manager==null){
                   manager=MyUtil.getTimerManager();
    TestApplicationListener.java
    package my.examples.mdb.timer;
    import commonj.timers.TimerManager;
    import weblogic.application.ApplicationException;
    import weblogic.application.ApplicationLifecycleEvent;
    import weblogic.application.ApplicationLifecycleListener;
    public class TestApplicationListener extends ApplicationLifecycleListener {
         public void preStart(ApplicationLifecycleEvent evt)throws ApplicationException {
              String logStr = ">>>>TestApplicationListener.preStart()>>>>";
              System.out.println(logStr+"entered...");
              super.preStart(evt);
              System.out.println(logStr+"leveaing...");
         public void postStart(ApplicationLifecycleEvent evt)throws ApplicationException {
              String logStr = ">>>>TestApplicationListener.postStart()>>>>";
              System.out.println(logStr+"entered...");
              super.postStart(evt);
              TimerManager timerManager = MyUtil.getTimerManager();
              System.out.println(logStr+"Got timer manager ==> "+timerManager);
              System.out.println(logStr+"leveaing...");
         public void preStop(ApplicationLifecycleEvent evt)throws ApplicationException {
              String logStr = ">>>>TestApplicationListener.preStop()>>>>";
              System.out.println(logStr+"entered...");
              TimerManager timerManager = MyUtil.getTimerManager();
              System.out.println(logStr+"Got timer manager ==> "+timerManager);
              super.preStop(evt);
              System.out.println(logStr+"leveaing...");
         public void postStop(ApplicationLifecycleEvent evt) throws ApplicationException{
              String logStr = ">>>>TestApplicationListener.postStop()>>>>";
              System.out.println(logStr+"entered...");
              super.preStop(evt);
              System.out.println(logStr+"leveaing...");
    MyUtil.java
    package my.examples.mdb.timer;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import commonj.timers.TimerManager;
    public class MyUtil {
         public static TimerManager getTimerManager() {
              TimerManager timerManager = null;
              try {
                   InitialContext ctx = new InitialContext();
                   timerManager = (TimerManager) ctx
                             .lookup("java:comp/env/timer/MyDefaultTimer");
                   System.out
                             .println("@@@@@Looked-up using java:comp/env/timer/MyDefaultTimer : "
                                       + timerManager);
              } catch (NamingException e) {
                   e.printStackTrace();
              return timerManager;
    }

    Thaks for your valuble information. I tried as you suggested!!! But NO luck . Still I am getting the issue.
    I am using a class(TestApplicationListener) implements ApplicationLifecycleListener to listen my application.
    I have overriden the methods preStart(), postStart(), preStop() and postStop().
    Given following entries in weblogic-application.xml
    <listener>
              <listener-class>my.examples.mdb.timer.TestApplicationListener</listener-class>
    </listener>     
    Also given
    <ejb>
                   <start-mdbs-with-application>false</start-mdbs-with-application>
    </ejb>          As you suggested.
    If I try to look-up timer manager from postStart() method of TestApplicationListener then it is giving NameNotFoundException
    , same exception is giving in preStop() method.
    If it is problem with initialization; I think, it should not give problem with preStop() method. (Correct me if I am wrong)
    If I try to lookup the timer manager from onMessage() method of my MDB, It is not giving any problem.
    I didn’t understand the reason why it is happening.
    Note: All the life cycle methods (preStart(), postStart(), preStop() and postStop() ) are getting executed when I start/stop/redeploy my application from console.

  • I can't get pages 5.01 to open pages files from iCloud, although they open in iCloud Pages without difficulty.

    I can't get Pages 5.01 to open Pages files from iCloud, although they open in iCloud Pages without difficulty.
    I am using the most up to date version of Mavericks and Pages and can log into iCloud without any problems.  Is this just a glitch?  The files all behaved properly under previous versions and the initial release of the new version of Pages.

    Pages for iCloud beta is a weird beast and as it says "beta".
    I think it is the least compatible of all the many different .pages files floating around out there.
    Peter

  • I recently updated my macbook, i don't know if that has any effect to my recent problem, but when i try to download and save .mp3 files from the internet, like i have done in the past, it downloads but not as an mp3 file, its "blank"

    i recently updated my macbook, i don't know if that has any effect to my recent problem, but when i try to download and save .mp3 files from the internet, like i have done in the past, it downloads but not as an mp3 file, its "blank" and when i try to open it, i can't? I NEED HELP !

    Here is the download page

  • When I opt to "download this as a file" from my email account, Firefox defaults to notepad to open the file. How can I change the default to MS Word?

    Question
    When I opt to "download this as a file" from my email account, Firefox defaults to notepad to open the file. How can I change the default to MS Word?

    Is FF downloading the file as a .txt file? If so, go to "Folder Options" in the windows control panel. Click on the "File Types" tab. Scroll down until you reach the TXT file extension. Look to see what that extension opens with (lower part of panel). It probably shows notepad. Click on the <Change> button. Scroll down until you find "Microsoft Word." Select it and click the <OK> button. That should show the TXT extension is now associated with Microsoft Word. Click the <Close> button at the bottom of the panel.
    If FF is downloading the file as any other type, use the same process as above except look for the corresponding extension instead. If the extension is not listed click on the <New> button and create an association using the extension in the file name and then associate it with MS Word.
    davewdan

  • How do I get CS5 Bridge/Photoshp to handle RAW files from my D800E?

    How do I get CS5 Bridge/Photoshop to handle RAW files from my D~800E?

    There are many who would say, based only on empiric data (boo) and not opinion (yay), that the most accurate raw conversions would be obtained using the Nikon software and not secondary processors like the Adobe converter. The DNG process makes irreversible changes to the raw data which may or may not matter but the DNG is not the same as the original raw file.
    You can do the experiment yourself, for FREE, and compare different methods of raw conversion. You may be surprised at what you see. You have to be because different converters tune to different image characteristics. Don't be taken in about claims Adobe makes for its convertor without proving them to yourself. Adobe has made deliberate pre-set choices for its converter and they may not be the best for you. Or they may be, as we have all become so used to what Adobe chooses we think we chose it ourselves.
    If I were able to afford, and had the energy to lug around a D800e, I might not want to compromise the image quality I just shelled out such massive bucks to obtain using the Adobe converter without proving that was the best option for me, but I don't do it for a living. Also, if you can shell out for a D800e and are enamored of the Adobe Converter realize it only costs $10/month for a CC subscription, possibly tax deductible, and you can still retain your older version of PS. The CC version of PS allows use of the ACR as a filter layer, if you are fond of the converter tools (which are much improved in the latest version).

  • HT5527 can another person download a large video file from my iCloud account

    Virgin user here !
    sorry dumb question and in a hurry !
    can another person download a large video file from my iCloud account ??
    thanks

    Welcome to the Apple Community.
    No but you can share clips up to 5 minutes in length using photo stream sharing streams.

  • How can I open different binary files from BLOB column ?

    If we store some type of binary file (XLS, DOC, PDF, EML and so on, not only pictures) in BLOB column how can I show the different contents? We use designer and forms 9i with PL/SQL.
    How can I copy the files from BLOB to file in a directory or how can I pass BLOB's content to the proper application directly to open it?

    The mime type is just a string as explained above (e.g. application/pdf...). There are lot of samples here and on metalink.
    E.g. add a column mime_type varchar(30) to your blob table. Create a procedure similar to the following:
    PROCEDURE getblob
    (P_FILE IN VARCHAR2
    IS
    vblob blob;
    vmime_type myblobs.mime_type%type;
    length number;
    begin
         select document, mime_type into vblob,vmime_type from myblobs where docname = p_file;
         length := dbms_lob.getlength(vblob);
         if length = 0 or vblob is null then
         htp.p('Document not available yet.');
         else
         owa_util.mime_header(vmime_type);
         htp.p('Content-Length: ' || dbms_lob.getlength(vblob));
         owa_util.http_header_close;
         wpg_docload.download_file(vblob);                
         end if;
    exception
         when others then
         htp.p(sqlerrm);
    END;
    Create a DAD on your application server (refer to documentation on how to create a DAD).
    Display the blob from forms (e.g. on a when-button-pressed trigger):
    web.show_document('http://myserver:port/DAD/getblob?p_file=myfilename','_blank');
    For storing blobs in a directory on your db server take a look at the dbms_lob package.
    For storing blobs in a directory on your app server take a look at WebUtil available on OTN.
    HTH
    Gerald Krieger

  • How to retrieve xml file from BLOB and display on browser with css/xslt

    Hi All,
    I am new to xml. I am storing my xml file into BLOB in database. Now in my jsp page I want to retrieve this xml file from BLOB and display in HTML/CSS/XSLT form...
    Pl. guide me.. any docs..?? Logic...??
    Thanks in Advance.
    Sandeep Oza

    Hello Sandeep!
    I'm not familiar with jsp but logic should be as follows:
    -in jsp page instantiate XML parser
    -load specified BLOB into parser
    Now you may traverse the XML tree or you might load XSL file and use transform method to transform XML according to XSL file.
    I have an example where I'm selecting XML straight from relational database and then transform it using XSL into appropriate HTML output, but it's written in PSP.
    You can try http://www.w3schools.com/default.asp for basics on XML, CSS, XSL. It's easy to follow with good examples.
    Regards!
    miki

  • Renaming files in blobs storage

    Hi,
    I want to rename files in blobs storage which are inside the container. I can't find any demo code. Please help
    Regards,
    Nitin

    Please note that rename operation is not natively supported in blob storage. So in order to rename blobs, you would need to perform 2 operations - Copy & Delete.
    So what you will do is copy the blob to a new name. Because copy operation is async, you must wait for the copy operation to finish. Once copy operation is completed successfully, you would then delete the blob.
    Hope this helps.

Maybe you are looking for

  • Null object not following 3D camera tracking points.

    After applying the 3d camera tracker I right click between three targets and select "create null and camera", this creates a null object correctly aligned with the selected target and a camera, however, when I scrub through the timeline the null obje

  • Oracle report formatting takes long time

    hi i am using oracle 10g Application Server 9.0.4.0.0 on Red hat linux AS 3 oracle reports are run thru JSP's some reports take long time to execute though query in it if executed on sql plus are fast. it is fond that that formatting is going on for

  • Music not appearing in iTunes library

    This is my last hope before I throw everything out of the window .... I have windows 7 and an old iPod Classic - never had issues before, but last 2 days I cannot transfer any music to the library and put on iPod. I have trawled through these posts,

  • Dynamic actions on OM Infotypes

    Hi All, Can we use dynamic actions for OM infotypes?

  • Logical port definition dynamically

    Hi all! In ABAP I'm using a Web Service proxy class to call the web service. I'm aware that a logical port must exist that points to the location of the service. I'm looking for a way in ABAP (not Web Dynpro) to determine / set the correct logical po