By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,011 Members | 1,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,011 IT Pros & Developers. It's quick & easy.

Client code for accessing file in an HttpResponse stream?

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.