Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Help with Response.WriteFile/TransmitFile

Reply
Thread Tools

Help with Response.WriteFile/TransmitFile

 
 
jeffpriz@yahoo.com
Guest
Posts: n/a
 
      03-04-2005
I'm have a situation where I need to put a download link/button on a
page, where the file to be downloaded does not exist on our webservers
.... So I'm using Response.WriteFile (i've also tried
Response.TransmitFile) to put the file into the response..

My trouble is with a Zip file.. The user gets propmpted to Open or Save
etc.. If they clicks save, the file saves just fine.. no problem... If
they click Open, their Zip program will open, with the file, except,
the contents of the zip are not there.. It opens as an empty zip!

my code looks something like this:
Dim thisFile As System.IO.FileInfo

thisFile = New FileInfo(file Location)
Response.Clear()

Response.AddHeader("Content-Length",
thisFile.Length.ToString)


Response.ContentType = "application/x-zip-compressed"

Response.AddHeader("Content-disposition", "filename=" &
thisFile.Name)


Response.TransmitFile(thisFile.FullName)
'Response.WriteFile(thisFile.FullName)

Response.End()

I've tried a ContentType of "application/x-zip-compressed", also, I've
just tried ContentType "application/none".. with no luck.

Am I missing a Header somewhere to tell the client how to open the
file?

thanks

jeffpriz

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QnJhZCBSb2JlcnRz?=
Guest
Posts: n/a
 
      03-04-2005
I have run into a similar problem with DOC and PDF files. The problem was
related to the content-expiration setting on the web site being "immediately"
.. Setting it to 1 minute cured it.

"" wrote:

> I'm have a situation where I need to put a download link/button on a
> page, where the file to be downloaded does not exist on our webservers
> .... So I'm using Response.WriteFile (i've also tried
> Response.TransmitFile) to put the file into the response..
>
> My trouble is with a Zip file.. The user gets propmpted to Open or Save
> etc.. If they clicks save, the file saves just fine.. no problem... If
> they click Open, their Zip program will open, with the file, except,
> the contents of the zip are not there.. It opens as an empty zip!
>
> my code looks something like this:
> Dim thisFile As System.IO.FileInfo
>
> thisFile = New FileInfo(file Location)
> Response.Clear()
>
> Response.AddHeader("Content-Length",
> thisFile.Length.ToString)
>
>
> Response.ContentType = "application/x-zip-compressed"
>
> Response.AddHeader("Content-disposition", "filename=" &
> thisFile.Name)
>
>
> Response.TransmitFile(thisFile.FullName)
> 'Response.WriteFile(thisFile.FullName)
>
> Response.End()
>
> I've tried a ContentType of "application/x-zip-compressed", also, I've
> just tried ContentType "application/none".. with no luck.
>
> Am I missing a Header somewhere to tell the client how to open the
> file?
>
> thanks
>
> jeffpriz
>
>

 
Reply With Quote
 
 
 
 
jeffpriz@yahoo.com
Guest
Posts: n/a
 
      03-04-2005
Brad,

Thanks for the reply, so this was an IIS setting change? or a
Code-change.. ?

thanks
jeffpriz

 
Reply With Quote
 
jeffpriz@yahoo.com
Guest
Posts: n/a
 
      03-04-2005
Hmm.. Set IIS' "Enable Content Expiration" to expire after 1 min, 1
hour, 1 Day, none had any effect...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
HELP - HELP - HELP =?Utf-8?B?S2ltb24gSWZhbnRpZGlz?= ASP .Net 4 03-09-2006 12:46 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 1 07-16-2004 01:12 PM
HELP WANTED HELP WANTED HELP WANTED Harvey ASP .Net 0 07-16-2004 10:00 AM
HELP! HELP! HELP! Opening Web Application Project Error =?Utf-8?B?dHJlbGxvdzQyMg==?= ASP .Net 0 02-20-2004 05:16 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57