473,958 Members | 7,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Downloading a mdb file.

Hi all,

I try to download a mdb file. If I simply display a link to the file,
the right-click/Save Target As doesn't work.
I couild rename the mdb file into a zip file, I think the download would
work, but the user would have to rename the zip file into a mdb file,
and I try to avoid this.

Here is the code I have so far:

<%
Response.Conten tType = "text/plain"
Response.AddHea der "Content-Transfer-Encoding", "binary;"
Response.AddHea der "Content-Disposition", "attachment ;
filename=backup .mdb;"

thepath = server.mappath( "/") & "\test\backup.m db"

Set fsob = Server.CreateOb ject("Scripting .FileSystemObje ct")
set thefile = fsob.OpenTextFi le(thepath)
response.Binary Write(thefile.R eadAll)

set fsob = Nothing
set thefile = Nothing
%>

The file is downloaded and saved on the local HD, but it is corrupted
and I can't open it with Access.
The mdb file on the server is 2,7 Mb and the locally saved file is 5,3
Mb.

I don't know exactly where is the problem. In the ContentType, in the
Encoding?
Or maybe the problem is in the OpenTextFile? Not the right way to open a
mdb file?

Does anybody know how to fix this code?

TIA
Yan

Jul 19 '05 #1
5 2946

"Yan Roosens" <ya*********@sk ynet.be> wrote in message
news:40******** *******@skynet. be...
Hi all,

I try to download a mdb file. If I simply display a link to the file,
the right-click/Save Target As doesn't work.

it works when i try it

I couild rename the mdb file into a zip file, I think the download would
work, but the user would have to rename the zip file into a mdb file,
and I try to avoid this.

Here is the code I have so far:

<%
Response.Conten tType = "text/plain"
Response.AddHea der "Content-Transfer-Encoding", "binary;"
Response.AddHea der "Content-Disposition", "attachment ;
filename=backup .mdb;"

thepath = server.mappath( "/") & "\test\backup.m db"

Set fsob = Server.CreateOb ject("Scripting .FileSystemObje ct")
set thefile = fsob.OpenTextFi le(thepath)
response.Binary Write(thefile.R eadAll)

set fsob = Nothing
set thefile = Nothing
%>

The file is downloaded and saved on the local HD, but it is corrupted
and I can't open it with Access.
The mdb file on the server is 2,7 Mb and the locally saved file is 5,3
Mb.

I don't know exactly where is the problem. In the ContentType, in the
Encoding?
Or maybe the problem is in the OpenTextFile? Not the right way to open a
mdb file?

Does anybody know how to fix this code?

TIA
Yan

Jul 19 '05 #2
Right-click/Save Target As on a regular link to an .mdb file should
work.

Best regards,
J. Paul Schmidt, Freelance ASP Web Consultant
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
Hi Paul,

Bullschmidt wrote:
Right-click/Save Target As on a regular link to an .mdb file should
work.


It should....but it doesn't.
Could it be because Access is not installed on the client?

I have tried with a text file and jpg file, it works as expected.

Thank you for the response.
Yan

Jul 19 '05 #4
If you have a web page with a link to it then it can be downloaded.
The referrer will allow it. No referrer = no download.

Example htm page:

<a href="data.mdb" >Download database file</a>

'dlbjr

'Unambit from meager knowledge of inane others,engender uncharted sagacity.
Jul 19 '05 #5
Hello,

Bullschmidt wrote:
Right-click/Save Target As on a regular link to an .mdb file should
work.


I have tried to download from a client with Access installed, and it
doesn't work.
So the problem is on the server. I will post in a IIS related news
group.

Thank you anyway.
Yan

Jul 19 '05 #6

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

Similar topics

5
6923
by: kevin | last post by:
Hi, Any help with this would be really appreciated! I'm trying to download a file from a remote server. The access permissions is okay but the problem I'm facing is that the file is getting downloaded before the Save As dialogue appears. As we will be downloading some large files, it's unpractical to have this. So far the code I have to download the file is
3
3882
by: Jocelyn Duhaylungsod | last post by:
I have been getting the following server errors sporadically while downloading excel, csv or xml file. Internet Explorer cannot download <file name> from <IP address> "The server returned an invalid or unrecognized response" / "The connection with the server was reset" I'm using Response.BinaryWrite to send down the file content as attachment (sample codes is attached below). I read some of the similar posts in the newsgroup about the...
4
3894
by: Richard L Rosenheim | last post by:
I know that I can download a file from a web server by using the WebClient.DownloadFile method. But, does anyone know of an example of downloading a file from a web server with the ability to monitor the download progress? I'm looking for either the number of bytes downloaded and/or percentage completed. TIA
4
1568
by: Jeremy Chapman | last post by:
I have build a web page that lists files in a database. When the user clicks on the file the page streams the file contents to the browser with code like: Response.AppendHeader("Content-Disposition","attachment;filename=" + strFileName); Response.AppendHeader("Content-Length",lLength.ToString()); Response.ContentType = strContentType; Response.BinaryWrite(binData); My problem is that if the file is html or xml, it appears in the...
7
4638
by: Frank | last post by:
Hi, On one of my server, downloading file by clicking a button give empt file. On the other servers work perfectly. Is any idea ? What should be change in IIS Metabase setting? After click the button on an aspx page, IE prompts the users whether they want to open, save or cancel the download with correct name. No matter click open or save, it started download and transfered 0 byte. I checked the server side it did created the file with...
2
2781
by: Tomas Martinez | last post by:
Hi there! I'm trying to download a file in my asp.net web, but when downloading it from a Firefox browser, instead of downloading the example.exe file, it's downloading example.exe.htm. My code is the following: string localfile = MyComponent.DownloadMyExe(index); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType="application/octet-stream";
5
1700
by: roland.groenvynck | last post by:
I try to build my first web form application with C#. I want to program the downloading of a file to the client . Therefore I can use WebClient.DownloadFile (url, filepath ); I would like that the user is able to select the directory(on his machine) with a kind of a control ? How can I do that? many thanks for helping me
4
2564
by: M. Noroozi Eghbali | last post by:
Hi, I need to download a file using OnClick event or Command of a ASP button. Is there any possible code for this? In ASPX file: <ASP:Button id="button1" runat="server" text="Start Download"></ASP:Button> In CS file: private void button1_Click(object sender, System.EventArgs e)
7
7799
by: raids51 | last post by:
Hello, i have a program that downloads a file using the httpwebrequest/response, and it usually works, but sometimes it will freeze at a random part of the download without an error. here is the code: 'Creating the request and getting the response Dim theResponse As HttpWebResponse Dim theRequest As HttpWebRequest Try 'Checks if the file exist theRequest = WebRequest.Create(Me.Filelocation) ...
1
2402
by: Bryan729 | last post by:
Hi, I created a public folder which were I upload my actual files and a database table named "file" which I put and stored the path for my actual files, I was wondering if there's a code for downloading a file the same as when you click a file there's a small pop up that will tell you to open or save as..
0
10241
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
10053
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11676
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...
1
11454
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
9975
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...
0
6419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5035
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
2
4622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3629
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.