open word doc from the server on the cients pc

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ton

    open word doc from the server on the cients pc

    Hi,

    I'm creating an application and I want to give users access to saved Word
    documents on the server. How can I establish this.

    I prefer to open specific Word documents directly into word on the client
    but if it is in a (different) browser it is ok.

    I've tried:
    <A HREF="Websitefo lder/systeemAT.doc"> systeemAT.doc</A>

    but I received an error:

    Server Error in '/WebSite2' Application.
    --------------------------------------------------------------------------------

    HTTP Error 403 - Forbidden
    Version Information: ASP.NET Development Server 8.0.0.0

    I prefer to give acces to a folder on a different disk on the server

    thanx

    Ton

  • Anthony Jones

    #2
    Re: open word doc from the server on the cients pc

    "ton" <ton@nospam.nlw rote in message
    news:a998b$48ae 86c6$541ef063$7 190@cache3.tilb u1.nb.home.nl.. .
    Hi,
    >
    I'm creating an application and I want to give users access to saved Word
    documents on the server. How can I establish this.
    >
    I prefer to open specific Word documents directly into word on the client
    but if it is in a (different) browser it is ok.
    >
    I've tried:
    <A HREF="Websitefo lder/systeemAT.doc"> systeemAT.doc</A>
    >
    but I received an error:
    >
    Server Error in '/WebSite2' Application.
    --------------------------------------------------------------------------
    ------
    >
    HTTP Error 403 - Forbidden
    Version Information: ASP.NET Development Server 8.0.0.0
    >
    I prefer to give acces to a folder on a different disk on the server

    Unless you are testing ASP.NET related code its not a good idea to test
    things using the development server.

    Try this using IIS and see what happens.



    --
    Anthony Jones - MVP ASP/ASP.NET


    Comment

    • Frederik Van Lierde

      #3
      Re: open word doc from the server on the cients pc

      Try the following idea:

      1. Read the file and get is into a Byte[]
      2. PLay with the context object

      !!! Set the ContentType to "application.ms word" for Word Documents,
      see the internet for other applications

      An example. Is used this example on http://www.getMyVCard.com,
      ofcourse I changed the ContentType :)


      Byte[] byteArray = the file readed;

      Context.Respons e.Clear();
      Context.Respons e.ContentType = "applicatio n/msword";
      Context.Respons e.AddHeader("Co ntent-Disposition", " filename=" +
      "filename.doc") ;
      Context.Respons e.AddHeader("Co ntent-Length",
      byteArray.Lengt h.ToString());
      Context.Respons e.BinaryWrite(b yteArray);
      Context.Respons e.Flush();


      I hope this bring you into the good direction

      Frederik Van Lierde


      Comment

      • Anthony Jones

        #4
        Re: open word doc from the server on the cients pc

        "Frederik Van Lierde" <frederik@blueo ceansgroup.comw rote in message
        news:dfaabe4e-395e-4543-a6e8-42f70f7b4318@y2 1g2000hsf.googl egroups.com...
        Try the following idea:
        >
        1. Read the file and get is into a Byte[]
        2. PLay with the context object
        >
        !!! Set the ContentType to "application.ms word" for Word Documents,
        see the internet for other applications
        >
        An example. Is used this example on http://www.getMyVCard.com,
        ofcourse I changed the ContentType :)
        >
        >
        Byte[] byteArray = the file readed;
        >
        Context.Respons e.Clear();
        Context.Respons e.ContentType = "applicatio n/msword";
        Context.Respons e.AddHeader("Co ntent-Disposition", " filename=" +
        "filename.doc") ;
        Context.Respons e.AddHeader("Co ntent-Length",
        byteArray.Lengt h.ToString());
        Context.Respons e.BinaryWrite(b yteArray);
        Context.Respons e.Flush();
        >
        >
        I hope this bring you into the good direction
        >
        Not really. If you've got static content sitting in your site its
        preferable to have IIS static content handler deliver it.

        If the word document is 40MBs how much memory is needed for the code above?
        If the user revisits the document do they get a cached version or does the
        server have to do all that again?

        BTW, what purpose does the Flush serve? What would happen if it were not
        there?

        --
        Anthony Jones - MVP ASP/ASP.NET


        Comment

        • Mark Rae [MVP]

          #5
          Re: open word doc from the server on the cients pc

          "Anthony Jones" <Ant@yadayadaya da.comwrote in message
          news:uD6YcIGBJH A.5316@TK2MSFTN GP04.phx.gbl...
          >Context.Respon se.Flush();
          >
          BTW, what purpose does the Flush serve?
          None, since it's the last line of the routne anyway.
          What would happen if it were not there?
          Nothing different.


          --
          Mark Rae
          ASP.NET MVP


          Comment

          Working...