473,587 Members | 2,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Client code for accessing file in an HttpResponse stream?

I am trying to save a file dynamically created in a webpage. I get the
following headers, but cannot figure out how to save the attachment. I am
basically trying to replicate what internet explorer would do in this case.

The headers I am getting are:

Headers {Content-Disposition: attachment; filename="dynam ic_file.mdb"
Connection: close
Cache-Control: private
Content-Type: application/octet-stream
Date: Tue, 06 Sep 2005 16:04:41 GMT
Expires: Thu, 06 Oct 2005 16:04:42 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
}

How do I save dynamic_file.md b?

Thanks,

- Daniel
Nov 19 '05 #1
5 3045
Do you mean you are trying to create a valid MDB file manually, from code,
and not trying to "send" one that's already created (at the server file
level) to the client?

If so then its not that easy. Some files are text based, and therefore
easily created, or have simple interpreters/converters (like excel) but
creating an MDB from nothing but text will require some sort of compiler I
would suspect. I think you are going to have to hit up an Access group and
ask them about that specifically though, if I understand your request right.
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Daniel Corbett" wrote:
The question is how do I try. I have found 0 code examples for this case.
There are lots of code examples which explain how to use WebClient to
download a static file given a URL to the file.

What I tried to do is to open the stream on the Response, and write that to
a file.
The file is an Access file and wasn't recognized by Access as being a valid
access file. Perhaps there is something else I need to do. Are the
headers included in that stream? How far do I have to go to skip them?

"Curt_C [MVP]" wrote:
What happened when you tried? Was there an error? Streaming a file to the
client is easily searchable but I wasnt sure if there was a specific aspect
that was causing the issue...??

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Daniel Corbett" wrote:
I am trying to save a file dynamically created in a webpage. I get the
following headers, but cannot figure out how to save the attachment. I am
basically trying to replicate what internet explorer would do in this case.

The headers I am getting are:

Headers {Content-Disposition: attachment; filename="dynam ic_file.mdb"
Connection: close
Cache-Control: private
Content-Type: application/octet-stream
Date: Tue, 06 Sep 2005 16:04:41 GMT
Expires: Thu, 06 Oct 2005 16:04:42 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
}

How do I save dynamic_file.md b?

Thanks,

- Daniel

Nov 19 '05 #2
The question is how do I try. I have found 0 code examples for this case.
There are lots of code examples which explain how to use WebClient to
download a static file given a URL to the file.

What I tried to do is to open the stream on the Response, and write that to
a file.
The file is an Access file and wasn't recognized by Access as being a valid
access file. Perhaps there is something else I need to do. Are the
headers included in that stream? How far do I have to go to skip them?

"Curt_C [MVP]" wrote:
What happened when you tried? Was there an error? Streaming a file to the
client is easily searchable but I wasnt sure if there was a specific aspect
that was causing the issue...??

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Daniel Corbett" wrote:
I am trying to save a file dynamically created in a webpage. I get the
following headers, but cannot figure out how to save the attachment. I am
basically trying to replicate what internet explorer would do in this case.

The headers I am getting are:

Headers {Content-Disposition: attachment; filename="dynam ic_file.mdb"
Connection: close
Cache-Control: private
Content-Type: application/octet-stream
Date: Tue, 06 Sep 2005 16:04:41 GMT
Expires: Thu, 06 Oct 2005 16:04:42 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
}

How do I save dynamic_file.md b?

Thanks,

- Daniel

Nov 19 '05 #3
What happened when you tried? Was there an error? Streaming a file to the
client is easily searchable but I wasnt sure if there was a specific aspect
that was causing the issue...??

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Daniel Corbett" wrote:
I am trying to save a file dynamically created in a webpage. I get the
following headers, but cannot figure out how to save the attachment. I am
basically trying to replicate what internet explorer would do in this case.

The headers I am getting are:

Headers {Content-Disposition: attachment; filename="dynam ic_file.mdb"
Connection: close
Cache-Control: private
Content-Type: application/octet-stream
Date: Tue, 06 Sep 2005 16:04:41 GMT
Expires: Thu, 06 Oct 2005 16:04:42 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
}

How do I save dynamic_file.md b?

Thanks,

- Daniel

Nov 19 '05 #4
Hi Daniel,

AS for the accessing the download file stream from httresponse. Here is
some of my understanding:

1. Is the remote web page direclty write down a file into the response
stream?

2. Are you using HttpWebRequest or any other component to request the file
downloading page?

As far as I know, if you're using HttpWebRequest, we can use the
HttpWebResponse .GetResponseStr eam() method to get the binary stream in the
http response message. Then, we can save the stream to a file on the hard
disk.

Please feel free to let me know if the above is the scenario you met. IF
there're any other concerns, please post here also. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Client code for accessing file in an HttpResponse stream?
| thread-index: AcWzQfAo9nX0Que ATNCtj82+W+VrIA ==
| X-WBNR-Posting-Host: 12.148.198.43
| From: =?Utf-8?B?Q3VydF9DIFt NVlBd?= <software_at_da rkfalz.com>
| References: <6B************ *************** *******@microso ft.com>
<B9************ *************** *******@microso ft.com>
<40************ *************** *******@microso ft.com>
| Subject: RE: Client code for accessing file in an HttpResponse stream?
| Date: Tue, 6 Sep 2005 17:20:23 -0700
| Lines: 66
| Message-ID: <C5************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1227 49
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Do you mean you are trying to create a valid MDB file manually, from
code,
| and not trying to "send" one that's already created (at the server file
| level) to the client?
|
| If so then its not that easy. Some files are text based, and therefore
| easily created, or have simple interpreters/converters (like excel) but
| creating an MDB from nothing but text will require some sort of compiler
I
| would suspect. I think you are going to have to hit up an Access group
and
| ask them about that specifically though, if I understand your request
right.
|
|
| --
| Curt Christianson
| site: http://www.darkfalz.com
| blog: http://blog.darkfalz.com
|
|
|
| "Daniel Corbett" wrote:
|
| > The question is how do I try. I have found 0 code examples for this
case.
| > There are lots of code examples which explain how to use WebClient to
| > download a static file given a URL to the file.
| >
| > What I tried to do is to open the stream on the Response, and write
that to
| > a file.
| > The file is an Access file and wasn't recognized by Access as being a
valid
| > access file. Perhaps there is something else I need to do. Are the
| > headers included in that stream? How far do I have to go to skip them?
| >
| > "Curt_C [MVP]" wrote:
| >
| > > What happened when you tried? Was there an error? Streaming a file to
the
| > > client is easily searchable but I wasnt sure if there was a specific
aspect
| > > that was causing the issue...??
| > >
| > > --
| > > Curt Christianson
| > > site: http://www.darkfalz.com
| > > blog: http://blog.darkfalz.com
| > >
| > >
| > >
| > > "Daniel Corbett" wrote:
| > >
| > > > I am trying to save a file dynamically created in a webpage. I
get the
| > > > following headers, but cannot figure out how to save the
attachment. I am
| > > > basically trying to replicate what internet explorer would do in
this case.
| > > >
| > > > The headers I am getting are:
| > > >
| > > > Headers {Content-Disposition: attachment;
filename="dynam ic_file.mdb"
| > > > Connection: close
| > > > Cache-Control: private
| > > > Content-Type: application/octet-stream
| > > > Date: Tue, 06 Sep 2005 16:04:41 GMT
| > > > Expires: Thu, 06 Oct 2005 16:04:42 GMT
| > > > Server: Microsoft-IIS/6.0
| > > > X-Powered-By: ASP.NET
| > > > }
| > > >
| > > > How do I save dynamic_file.md b?
| > > >
| > > > Thanks,
| > > >
| > > > - Daniel
|

Nov 19 '05 #5
Hi Daniel,

Have you got any further progress on this issue or does the suggestions in
my last reply helps a little? If there're any other things we can help,
please feel free to post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 144873056
| References: <6B************ *************** *******@microso ft.com>
<B9************ *************** *******@microso ft.com>
<40************ *************** *******@microso ft.com>
<C5************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online. microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Wed, 07 Sep 2005 05:54:49 GMT
| Subject: RE: Client code for accessing file in an HttpResponse stream?
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| Message-ID: <pE************ **@TK2MSFTNGXA0 1.phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Lines: 115
| Path: TK2MSFTNGXA01.p hx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1227 94
| NNTP-Posting-Host: tomcatimport2.p hx.gbl 10.201.218.182
|
| Hi Daniel,
|
| AS for the accessing the download file stream from httresponse. Here is
| some of my understanding:
|
| 1. Is the remote web page direclty write down a file into the response
| stream?
|
| 2. Are you using HttpWebRequest or any other component to request the
file
| downloading page?
|
| As far as I know, if you're using HttpWebRequest, we can use the
| HttpWebResponse .GetResponseStr eam() method to get the binary stream in
the
| http response message. Then, we can save the stream to a file on the hard
| disk.
|
| Please feel free to let me know if the above is the scenario you met. IF
| there're any other concerns, please post here also. Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
| --------------------
| | Thread-Topic: Client code for accessing file in an HttpResponse stream?
| | thread-index: AcWzQfAo9nX0Que ATNCtj82+W+VrIA ==
| | X-WBNR-Posting-Host: 12.148.198.43
| | From: =?Utf-8?B?Q3VydF9DIFt NVlBd?= <software_at_da rkfalz.com>
| | References: <6B************ *************** *******@microso ft.com>
| <B9************ *************** *******@microso ft.com>
| <40************ *************** *******@microso ft.com>
| | Subject: RE: Client code for accessing file in an HttpResponse stream?
| | Date: Tue, 6 Sep 2005 17:20:23 -0700
| | Lines: 66
| | Message-ID: <C5************ *************** *******@microso ft.com>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| | NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| | Xref: TK2MSFTNGXA01.p hx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:1227 49
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| |
| | Do you mean you are trying to create a valid MDB file manually, from
| code,
| | and not trying to "send" one that's already created (at the server file
| | level) to the client?
| |
| | If so then its not that easy. Some files are text based, and therefore
| | easily created, or have simple interpreters/converters (like excel) but
| | creating an MDB from nothing but text will require some sort of
compiler
| I
| | would suspect. I think you are going to have to hit up an Access group
| and
| | ask them about that specifically though, if I understand your request
| right.
| |
| |
| | --
| | Curt Christianson
| | site: http://www.darkfalz.com
| | blog: http://blog.darkfalz.com
| |
| |
| |
| | "Daniel Corbett" wrote:
| |
| | > The question is how do I try. I have found 0 code examples for this
| case.
| | > There are lots of code examples which explain how to use WebClient to
| | > download a static file given a URL to the file.
| | >
| | > What I tried to do is to open the stream on the Response, and write
| that to
| | > a file.
| | > The file is an Access file and wasn't recognized by Access as being a
| valid
| | > access file. Perhaps there is something else I need to do. Are
the
| | > headers included in that stream? How far do I have to go to skip
them?
| | >
| | > "Curt_C [MVP]" wrote:
| | >
| | > > What happened when you tried? Was there an error? Streaming a file
to
| the
| | > > client is easily searchable but I wasnt sure if there was a
specific
| aspect
| | > > that was causing the issue...??
| | > >
| | > > --
| | > > Curt Christianson
| | > > site: http://www.darkfalz.com
| | > > blog: http://blog.darkfalz.com
| | > >
| | > >
| | > >
| | > > "Daniel Corbett" wrote:
| | > >
| | > > > I am trying to save a file dynamically created in a webpage. I
| get the
| | > > > following headers, but cannot figure out how to save the
| attachment. I am
| | > > > basically trying to replicate what internet explorer would do in
| this case.
| | > > >
| | > > > The headers I am getting are:
| | > > >
| | > > > Headers {Content-Disposition: attachment;
| filename="dynam ic_file.mdb"
| | > > > Connection: close
| | > > > Cache-Control: private
| | > > > Content-Type: application/octet-stream
| | > > > Date: Tue, 06 Sep 2005 16:04:41 GMT
| | > > > Expires: Thu, 06 Oct 2005 16:04:42 GMT
| | > > > Server: Microsoft-IIS/6.0
| | > > > X-Powered-By: ASP.NET
| | > > > }
| | > > >
| | > > > How do I save dynamic_file.md b?
| | > > >
| | > > > Thanks,
| | > > >
| | > > > - Daniel
| |
|
|

Nov 19 '05 #6

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

Similar topics

2
1939
by: Sleepy | last post by:
I am wanting to allow a client to download a file from a web server and save it on their local PC. The only way that I have found to do this is to use HTTP headers. I am using the code shown below (which I have copied with some variable name changes) from a book on ASP.NET programming. This code sits in the Page_Load event of a file called...
3
2045
by: Steven Thomas | last post by:
I am working on a ASP.NET application using VB.NET. I have a function that creates a snapshot file on a separate server and passes a path back to the webpage. Now I want to display the snapshot. If I cut and paste the path into the browser it opens snapshot viewer. Exactly what I want. However, if I response.redirect to the path, I get a...
8
1720
by: david | last post by:
I have made a test: copy a text file to clinet side. But fails. What I did is that create a web method in web services that read a text in server side and return the text file as string. On the client side, the method is called in a windows form client which stores the string and write the string to a file. Though the file contains the...
3
1217
by: Fredrik | last post by:
I want to generate a pdf file of "the current page". It is a ASP.NET aspx file created partly from GET parameters, but most often using the ASP.NET event model (i.e. clicking buttons etc). One of the buttons is called "Generate a pdf document of the current page" and it clicking it should create a pdf document on the server side and...
8
6333
by: ad | last post by:
How can I download a file form Server to client?
11
2772
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or < or several others, it converts them to html, such as &amp; or &lt; which can sometimes cause my scripts not to work. How can I prevent ASP.NET from...
1
1199
by: Nathaniel | last post by:
A few stings ago I asked: I play an online game application that displays how many points I have earned. I want the number of points I have earned to appear as a string in a text box in the program I am writing in VB.net. If I already knew the window handle, is there someway of accessing the I/O stream to find out my point status? And...
12
4756
by: =?Utf-8?B?RnJlZU5FYXN5?= | last post by:
Hello, the scenario: There's an ASPX page which shows some text and has three buttons at the bottom: Save, Print and Close. Print and close is done by javascript. But how can I save the page on the client's computer? He/she could do this using the browser (file/save), but I need to have it done by pressing the pushbutton. In my...
4
1241
by: Barbiturico76 | last post by:
Hi again, another question for you. In C# WinForms I used to create html and visualizing it in a IE wrapper, without even create a file on the system. It was very useful. Is there a way to reproduce the same behaviour in ASP.NET? I mean, a user send a request of a page with some parameters, my WebApp elaborates them and gives back a brand...
0
7915
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...
0
7843
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...
1
7967
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...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6619
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...
1
5712
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...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1185
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...

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.