Groups | Blog | Home
all groups > asp.net webcontrols > october 2003 >

asp.net webcontrols : Why save as dialog is displaying twise


Jose Gonzalez
10/30/2003 9:07:58 AM
What browser are you using?
this sounds similar to a problem I was having before.
I might be wrong but I think it was an issue in IE 5.x.

[quoted text, click to view]
Vijay Neelam
10/30/2003 1:08:36 PM
Hi all,
Dim a As String = Response.ContentType
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/msword"
Response.AddHeader("content-disposition", "attachment;
filename=Document.doc")
Response.Write(strDoc)
Response.ContentType = a
Response.End()

I'm writing this code in ASP.NET I'm getting download dialog box but I'm
getting twise if I clicked on open.

My purpose is I want to download a worddocument from server and also need to
write some string in that document.

Open is only opening MSWord window but not opening document.

Does any one know solution to this problem.. please post

Thank you,
Vijay Neelam

HD
10/30/2003 4:22:29 PM
Dont think things have changed with ASP.NET to that an extent.
What you are trying to do Vijay would only tell the client browser that the
server is pushing data of type word in the response. hence it asks you
whether you would like to save it.
If you want ASP.net to word and write something to the file then you will
have to look into server side code. Create an object of type
word.application and then write to it. Save it n the harddrive and transfer
the script to the relative location of word doc. or save it and then use
binary reading and write the binary info to response post the headers you
were using.

hope i help clear things out,

HD

[quoted text, click to view]

HD
10/30/2003 9:30:15 PM
Jose,

The reason its asked atleast once is that .doc is not associated with the
browsers unless you have a plugin when then i think it will ask you once.
The above example would work fine with txt file cause txt files not have any
custom headers and txt files are fine with txt files are client response.
With .doc you have a custom header and he needs to write the .doc file
header in order to populate it.

HD

The problem is because the header is possibly not perfect.
Dont know everything about ASP.NET but
[quoted text, click to view]

Vijay Neelam
10/31/2003 2:28:04 PM
I followed all suggestion given in link you have mentioned.Even I cleared
Headers , But still I'm getting open dialog twise...

I'm using IE 6.02800.1106

Update Versions:; SP1; Q810847; Q813951; Q813489; Q330994; Q818529; Q822925;
Q828750;

Even I checked all possible combinations in response.header like Filename
and filename
\".

Response.Buffer = True
Response.Clear()
Response.Charset = "UTF-8"
Response.ContentType = "application/msword"
'Response.ContentType = "application/octet-stream"
Response.ClearHeaders()
Rsponse.AddHeader("content-disposition", "attachment;
filename=document.doc")
Response.Write("String")
Response.Flush()
Response.End()
Thank you
Regards
vijay neelam
[quoted text, click to view]

AddThis Social Bookmark Button