473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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="dynamic_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.mdb?

Thanks,

- Daniel
Nov 19 '05 #1
5 3024
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="dynamic_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.mdb?

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="dynamic_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.mdb?

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="dynamic_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.mdb?

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.GetResponseStream() 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: AcWzQfAo9nX0QueATNCtj82+W+VrIA==
| X-WBNR-Posting-Host: 12.148.198.43
| From: =?Utf-8?B?Q3VydF9DIFtNVlBd?= <software_at_darkfalz.com>
| References: <6B**********************************@microsoft.co m>
<B9**********************************@microsoft.co m>
<40**********************************@microsoft.co m>
| 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**********************************@microsoft.co m>
| 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.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:122749
| X-Tomcat-NG: microsoft.public.dotnet.framework.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="dynamic_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.mdb?
| > > >
| > > > 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**********************************@microsoft.co m>
<B9**********************************@microsoft.co m>
<40**********************************@microsoft.co m>
<C5**********************************@microsoft.co m>
| 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.public.dotnet.framework.aspnet
| Message-ID: <pE**************@TK2MSFTNGXA01.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 115
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:122794
| NNTP-Posting-Host: tomcatimport2.phx.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.GetResponseStream() 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: AcWzQfAo9nX0QueATNCtj82+W+VrIA==
| | X-WBNR-Posting-Host: 12.148.198.43
| | From: =?Utf-8?B?Q3VydF9DIFtNVlBd?= <software_at_darkfalz.com>
| | References: <6B**********************************@microsoft.co m>
| <B9**********************************@microsoft.co m>
| <40**********************************@microsoft.co m>
| | 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**********************************@microsoft.co m>
| | 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.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl
| microsoft.public.dotnet.framework.aspnet:122749
| | X-Tomcat-NG: microsoft.public.dotnet.framework.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="dynamic_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.mdb?
| | > > >
| | > > > Thanks,
| | > > >
| | > > > - Daniel
| |
|
|

Nov 19 '05 #6

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

Similar topics

2
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...
3
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. ...
8
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...
3
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...
8
by: ad | last post by:
How can I download a file form Server to client?
11
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...
1
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...
12
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...
4
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...
0
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...

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.