473,657 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot find file error on Open dialog, Save works fine

Hi all,

I've got a vb.net web application that is using a web service to
stream documents from a repository. Once the service feeds me the
document I'l downloading it using the browser response functions. If
I choose to Save it works every time. If I choose to open the file I
get an error saying the file cannot be found, create a new file? The
save does occassionally work, every other attempt at best. Any ideas
would be appreciated!

Here is my code...

Private Sub RetrieveDocumen t(ByVal e As Integer)

Dim dr As DataRow
Dim f As Byte()
Dim dtVFDocs As DataTable
Dim DocKey As Integer
Dim DownloadFileNam e As String

dtVFDocs = Session("Virtur alFolderContent s")
dr = dtVFDocs.Rows(e )
DocKey = dr("Key")
DownloadFileNam e = CreateDownloadF ileName(dr("Doc TypeName"),
dr("OriginalFil eName"), dr("StoragePath "))

'Create web service object
Dim a As New WAS.WebArchiveS ervice

'Execute web service function and return results
f = a.GetDocument(S ession("Company ID").ToString ,
Session("Connec tionString").To String, Session("User") , DocKey)

If UBound(f) 0 Then
'send file back to client browser if the file isn't 0
bytes
Response.Clear( )
Response.Append Header("Content-Disposition", "attachment ;
filename=" & DownloadFileNam e)
Response.Append Header("Content-Length", UBound(f))
Response.Conten tType = "applicatio n/octet-stream"
Response.Conten tType = "text/plain"
Response.Flush( )
Response.Binary Write(f)
Response.End()
End If

'cleanup
a = Nothing
f = Nothing
dr = Nothing
dtVFDocs = Nothing
End Sub
Sep 15 '08 #1
0 1726

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
10326
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line 120''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1
2585
by: Bob | last post by:
I am displaying a form with a datagrid populated from a select of database records which now exceed 12,000 when I select them all. The form displays just fine with all 12,000+ entries but when I leave the form to go back to the originating program, I get a "The page cannot be displayed" screen for "Cannot find server or DNS error" "Internet Explorer". But when I select a lesser number of records - under 12,000 (don't think there is...
4
2600
by: Rob | last post by:
I have an Access application that allows users to open up certain files from within Access (.doc files with automation, .pdf's with a pdf viewing form). Other formats, we want to use Internet Explorer to show, using a plug-in). THis works fine as long as they have the plug-in installed. If they don't have the plug-in, when I try to open the file with IE, it gives the old "Would you like to OPEN this file or SAVE it to disk?" and it...
4
3676
by: Dorte | last post by:
Hi, I am using the code below to stream a CSV file with the response object. Dim FileName As String = "Test.csv" With Web.HttpContext.Current.Response Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" & FileName) .Charset = ""
0
1506
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to have o create a temporary file on the web server everytime someone want to run and export. When I call the ExportToBrowser function the user gets the standard open/save file dialog box. If the user chooses to save the file the program works fine,...
1
1797
by: jdhavo | last post by:
I'm trying to download an image file using XML from a web service. When the dialog box appears asking if I want to save the document or open it, If I click save and then open it, it works fine. If I click open, I get an error that the header is not recognized. Node 3 contains the binary document returned from the Doc_Qanda_rev.exe. Here is my code: ASPX Module: sXML = pdmWS.GetBinaryDoc(ErrorCode, ErrorMsg, e.Item.Cells(5).Text.Trim,...
3
3301
by: mo | last post by:
I have an application that uses Reporting Services. When the user chooses to print a report, they are taken to a window that allows them to fill in parameters for the report. They then click a button to either export to PDF or to EXCEL. Once the report is generated, the byte array containing the data is put into session and an aspx page is loaded into a hidded iframe that "prints" the report (using the byte array from session) causing...
17
8018
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: I am trying to use the SaveFileDialog class to get a filename, which is subsequently opened for writing (write access, read sharing, but using read/write sharing doesn't make the problem go away anyway). Sometimes, on the statement where I...
0
336
by: =?Utf-8?B?RmlsZSBEb3dubG9hZCBQcm9ibGVt?= | last post by:
The File Download Dialog Box just disappears when either the Open or Save button is clicked on the Dialog Box, after I let the File Download Dialog Box stay there for more than three minutes. The File Download works fine if I clicked the Open or Save button within three minutes of the Dialog Box showed up. I'd like to have the Dialog Box works, say up to 20 minutes. I tried the following code, but it doesn't work.
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.