Why save as dialog is displaying twise

Discussion in 'ASP .Net Web Controls' started by Vijay Neelam, Oct 30, 2003.

  1. Vijay Neelam

    Vijay Neelam Guest

    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
     
    Vijay Neelam, Oct 30, 2003
    #1
    1. Advertising

  2. Vijay Neelam

    HD Guest

    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

    "Vijay Neelam" <> wrote in message
    news:...
    > 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, Oct 30, 2003
    #2
    1. Advertising

  3. 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.

    >-----Original Message-----
    >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
    >
    >
    >.
    >
     
    Jose Gonzalez, Oct 30, 2003
    #3
  4. Vijay Neelam

    HD Guest

    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
    "Jose Gonzalez" <> wrote in message
    news:019d01c39f08$5e499060$...
    > 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.
    >
    > >-----Original Message-----
    > >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, Oct 30, 2003
    #4
  5. Vijay Neelam

    Vijay Neelam Guest

    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
    "HD" <> wrote in message
    news:...
    > 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
    > "Jose Gonzalez" <> wrote in message
    > news:019d01c39f08$5e499060$...
    > > 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.
    > >
    > > >-----Original Message-----
    > > >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
    > > >
    > > >
    > > >.
    > > >

    >
    >
     
    Vijay Neelam, Oct 31, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vijay Neelam

    Why save dialog displaying twise

    Vijay Neelam, Oct 30, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    309
    Oliver
    Oct 30, 2003
  2. neoswf
    Replies:
    4
    Views:
    505
    Travis Newbury
    Jan 30, 2006
  3. BusyBoy
    Replies:
    2
    Views:
    615
    =?Utf-8?B?TGVvbiBNYXluZQ==?=
    Oct 31, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,076
    Smokey Grindel
    Dec 2, 2006
  5. Vijay Neelam

    Why save dialog displaying twise

    Vijay Neelam, Oct 30, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    127
    Vijay Neelam
    Oct 30, 2003
Loading...

Share This Page