Client code for accessing file in an HttpResponse stream?

G

Guest

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
 
G

Guest

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
 
G

Guest

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?
 
G

Guest

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...??
 
S

Steven Cheng[MSFT]

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: <[email protected]>
<[email protected]>
<[email protected]>
| Subject: RE: Client code for accessing file in an HttpResponse stream?
| Date: Tue, 6 Sep 2005 17:20:23 -0700
| Lines: 66
| Message-ID: <[email protected]>
| 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
|
 
S

Steven Cheng[MSFT]

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: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (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: <[email protected]>
| 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: <[email protected]>
| <[email protected]>
| <[email protected]>
| | Subject: RE: Client code for accessing file in an HttpResponse stream?
| | Date: Tue, 6 Sep 2005 17:20:23 -0700
| | Lines: 66
| | Message-ID: <[email protected]>
| | 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
| |
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top