Response.AddHeader("Content-Disposition"....

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

    Response.AddHeader("Content-Disposition"....

    I've this statement in my output's creation:

    Response.Clear( )

    Response.Conten tType = "applicatio n/vnd.google-earth.kml+xml kml"

    Response.AddHea der("Content-Disposition", "inline; filename=Log_" &
    activityLogID & ".kml")

    The strage is that on my development server all works (IE try to open the
    file with GE, and if I force it to save the file when I click on the link,
    it prompts for "Log_....." file name). But on production server, IE doesn't
    recognize MIME type, and if I force it to save the file, it prompts for the
    original aspx's file name.
    Firefox works well on all two servers. Where is the error?

    thanks



  • Trapulo

    #2
    Re: Response.AddHea der("Conte nt-Disposition&quo t;....

    "Steven Cheng[MSFT]" <stcheng@online .microsoft.comw rote in message
    news:haJRQ9n0GH A.228@TK2MSFTNG XA01.phx.gbl...
    Hello Trapulo,
    >
    From your description, you're using ASP.NET page to flush out some google
    earth map file and let the client-side choose the google earth, however,
    you found this works when running the application on development server
    but
    not work when running on a production server ,correct?
    yes
    As for the different behavior, are you getting them on the same client
    machine when visiting the server page or just test locally on each server?
    I would recommend you try different remote client machine to see whether
    you'll get different behavior.
    I try from the same machine, that is also the development server. I've also
    tried from other machines, but only calling the production server, and I
    have the same behavior.
    Based on my experience, the client-side browser's behavior against
    handling
    different mime-type is depend on its internal implementation. For IE, you
    can have a look at the following msdn article:
    >
    #MIME Type Detection in Internet Explorer
    Gain technical skills through documentation and training, earn certifications and connect with the community

    p?frame=true
    I think the problem can be here:
    "If a positive match is found (one of the hard-coded tests succeeded), this
    MIME type is immediately returned as the final determination, overriding the
    server-provided MIME type (this type of behavior is necessary to identify a
    ..gif file being sent as text/html). During scanning, it is determined if the
    buffer is predominantly text or binary."

    maybe IE scan content, and see that it is an xml file. So it shows it as
    xml, ignoring mime directive. If this can explain the problem (and then I
    don't know how to solve it because this is xml, but IE may open with right
    viewer), this doesn't explain why calling the page on the production server
    works.
    And if the problem is specific to server, you can check the registered
    mime-type in IIS 6's service manager(see my attached screenshot in this
    message). You need to select the topest(machine) node in IIS manager and
    right click to choose "properties " menu.
    Yes, I know this. But if I am generating the kml format from aspx, I think
    that MIME types are unuseful, aren't them? In fact, either on my development
    server I cannot find a setting related to this format. The only difference
    between two servers is that the development one has google earth installed,
    but I think it's strange it can change IIS behavor..
    and as for the filename problem, what's the behevior if you choose the
    code
    as below:
    >
    =============== =========
    Response.ClearH eaders();
    Response.ClearC ontent();
    >
    Response.Conten tType = "applicatio n/vnd.google-earth.kml+xml kml"
    >
    Response.AddHea der("Content-Disposition", "attachment ; filename=Log_" &
    activityLogID & ".kml")
    >
    =============== ====
    >
    this will always prompt for file open or save.
    I try this, however my requirenment is to open direct the file and not to
    save it. However, it can be an acceptable tradeoff if this can work with IE
    also, and not with firefox.

    thanks



    Comment

    • Steven Cheng[MSFT]

      #3
      Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....

      Thanks for your reply Trapulo,

      If you get the different results on the same client machie against
      differetn target server. It is still likely the response stream contains
      different content/headers. As for those IIS server mime-type setting,
      they're actually read from the server machine's registry. Also, you
      mentioned that the difference between the two servers is that development
      server has google earch installed while the deployment machine not, you can
      check whether the mime-type lists on the two machines also vary.

      For general testing, I think you can try put a static kml file in IIS
      virual diretory and use browser to navigate to it to see how the client
      browser process it. You can also use some network trace tools to capture
      the http response stream of the two different response(correc t and
      incorrect) to see what's the difference in the raw response.

      Sincerely,

      Steven Cheng

      Microsoft MSDN Online Support Lead


      This posting is provided "AS IS" with no warranties, and confers no rights.


      Comment

      • Trapulo

        #4
        Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....


        "Steven Cheng[MSFT]" <stcheng@online .microsoft.comw rote in message
        news:4RrLSTZ1GH A.4548@TK2MSFTN GXA01.phx.gbl.. .
        Thanks for your reply Trapulo,
        >
        If you get the different results on the same client machie against
        differetn target server. It is still likely the response stream contains
        different content/headers. As for those IIS server mime-type setting,
        they're actually read from the server machine's registry. Also, you
        mentioned that the difference between the two servers is that development
        server has google earch installed while the deployment machine not, you
        can
        check whether the mime-type lists on the two machines also vary.
        >
        I tried to find some specific settings on my development server, but it
        seems that GE has not defined any setting (and, in fact, it seems
        reasonable: it's very strange that it can update IIS settings..).
        For general testing, I think you can try put a static kml file in IIS
        virual diretory and use browser to navigate to it to see how the client
        browser process it.
        how can this work? If the two servers haven't any kml related mime setting,
        IIS cannot stream any header..

        You can also use some network trace tools to capture
        the http response stream of the two different response(correc t and
        incorrect) to see what's the difference in the raw response.
        Can you suggest any simple tool I can use? I haven't it and I don't know
        what can I use

        However, I've checked that with "attachment " instead of "inline" in
        content.disposi tion (as you suggested), IE starts google earth and shows the
        file if I select "open" when it asks if open or save the file. It's a
        workaround and it's not the real solution, but it's still a step away.

        thanks


        Comment

        • Steven Cheng[MSFT]

          #5
          Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....

          Thanks for your reply Trapulo,

          For your questions in the last reply:


          I tried to find some specific settings on my development server, but it
          seems that GE has not defined any setting (and, in fact, it seems
          reasonable: it's very strange that it can update IIS settings..).
          =============== =============== ====
          Yes, I agree that GE won't add any particular settings on the server.
          However, I think it may register the mine-type in registery(whch will
          display in the mime type list). Is this the difference between the two
          servers?



          how can this work? If the two servers haven't any kml related mime setting,
          IIS cannot stream any header..
          =============== =============== ==========
          due to my limit experience with IIS, I can not gurantee the exact behavior.
          However, the mime-type list you see in the IIS management console's root
          node will affect the response content if the document extension is matching
          one of the mime-type.



          Can you suggest any simple tool I can use? I haven't it and I don't know
          what can I use
          =============== =============== =========
          I usually use the trace utility in Soap Toolkit 3.0 to capture http
          request/response messages, you can find it in the following location:

          #SOAP Toolkit 3.0

          9753-86F052EC8450&di splaylang=en

          Many guys like using Fiddler to debug IE or related issue, it can also
          capture http messages process by IE:

          #Http Debugging with Fiddler


          Hope this helps also.

          Sincerely,

          Steven Cheng

          Microsoft MSDN Online Support Lead


          This posting is provided "AS IS" with no warranties, and confers no rights.





          Comment

          • Trapulo

            #6
            Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....


            "Steven Cheng[MSFT]" <stcheng@online .microsoft.comw rote in message
            news:dQ8p0%23J2 GHA.4548@TK2MSF TNGXA01.phx.gbl ...
            Thanks for your reply Trapulo,
            >
            For your questions in the last reply:
            >
            I tried to find some specific settings on my development server, but it
            seems that GE has not defined any setting (and, in fact, it seems
            reasonable: it's very strange that it can update IIS settings..).
            =============== =============== ====
            Yes, I agree that GE won't add any particular settings on the server.
            However, I think it may register the mine-type in registery(whch will
            display in the mime type list). Is this the difference between the two
            servers?
            I cannot find any difference. However, I also know that if I override with
            response.Conten tType the default mime type from aspx, IIS will stream data
            with my mime type, and it will not use registry settings..
            how can this work? If the two servers haven't any kml related mime
            setting,
            IIS cannot stream any header..
            =============== =============== ==========
            due to my limit experience with IIS, I can not gurantee the exact
            behavior.
            However, the mime-type list you see in the IIS management console's root
            node will affect the response content if the document extension is
            matching
            one of the mime-type.
            yes. But I'm streaming data from an aspx file, so IIS cannot work with
            extension to set kml mime type. It uses aspx extension to start ASP.NET, the
            I can set the mime streamed to the client..
            Can you suggest any simple tool I can use? I haven't it and I don't know
            what can I use
            =============== =============== =========
            I usually use the trace utility in Soap Toolkit 3.0 to capture http
            request/response messages, you can find it in the following location:
            I find this tool that is very simple and quick to use:


            Results:

            This is from production server:
            HTTP/1.x 200 OK
            Cache-Control: private
            Date: Fri, 15 Sep 2006 09:32:42 GMT
            Content-Type: application/vnd.google-earth.kml+xml kml; charset=utf-8
            Server: Microsoft-IIS/6.0
            X-Powered-By: ASP.NET
            X-AspNet-Version: 2.0.50727
            content-disposition: attachment; filename=Locali zzazione.kml
            Content-Encoding: gzip
            Vary: Accept-Encoding
            Transfer-Encoding: chunked

            This is from my dev envonment:
            HTTP/1.x 200 OK
            Server: ASP.NET Development Server/8.0.0.0
            Date: Fri, 15 Sep 2006 09:35:36 GMT
            X-AspNet-Version: 2.0.50727
            content-disposition: attachment; filename=Locali zzazione.kml
            Cache-Control: private
            Content-Type: application/vnd.google-earth.kml+xml kml; charset=utf-8
            Content-Length: 1001
            Connection: Close

            This is from my development server, using IIS:
            HTTP/1.x 200 OK
            Date: Fri, 15 Sep 2006 09:37:58 GMT
            Server: Microsoft-IIS/6.0
            X-Powered-By: ASP.NET
            X-AspNet-Version: 2.0.50727
            content-disposition: attachment; filename=Locali zzazione.kml
            Cache-Control: private
            Content-Type: application/vnd.google-earth.kml+xml kml; charset=utf-8
            Content-Length: 969

            And this is an example (from dev IIS) if I restore the content disposition
            value to inline:
            HTTP/1.x 200 OK
            Date: Fri, 15 Sep 2006 09:42:14 GMT
            Server: Microsoft-IIS/6.0
            X-Powered-By: ASP.NET
            X-AspNet-Version: 2.0.50727
            content-disposition: inline; filename=Locali zzazione.kml
            Cache-Control: private
            Content-Type: application/vnd.google-earth.kml+xml kml; charset=utf-8
            Content-Length: 969

            I cannot find any interesting difference.
            From dev server, IE open GE. From production, it still shows data as
            standard xml in IE itself :(((




            Comment

            • Steven Cheng[MSFT]

              #7
              Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....

              Hi Trapulo,

              Thanks for your followup.

              This does sound a bit strange though we can get that install the GE on the
              server will make the things work, yes?

              Anyway, I'll ask some other IIS or ASP.NET engineers to see whether they
              have any ideas on this. I'll update you if I get any further information on
              this.

              Sincerely,

              Steven Cheng

              Microsoft MSDN Online Support Lead


              This posting is provided "AS IS" with no warranties, and confers no rights.

              Comment

              • Steven Cheng[MSFT]

                #8
                Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....

                Hi Trapulo,

                Just post this message you inform you that I'm still waiting for some
                information from other product team engineer. I'll update you as soon as I
                get any new feedback.

                Sincerely,

                Steven Cheng

                Microsoft MSDN Online Support Lead


                This posting is provided "AS IS" with no warranties, and confers no rights.

                Comment

                • Trapulo

                  #9
                  Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....

                  Thank you.

                  Hope they can help us.


                  "Steven Cheng[MSFT]" <stcheng@online .microsoft.comw rote in message
                  news:pSKX6DW3GH A.4464@TK2MSFTN GXA01.phx.gbl.. .
                  Hi Trapulo,
                  >
                  Just post this message you inform you that I'm still waiting for some
                  information from other product team engineer. I'll update you as soon as I
                  get any new feedback.
                  >
                  Sincerely,
                  >
                  Steven Cheng
                  >
                  Microsoft MSDN Online Support Lead
                  >
                  >
                  This posting is provided "AS IS" with no warranties, and confers no
                  rights.
                  >

                  Comment

                  • Steven Cheng[MSFT]

                    #10
                    Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....

                    Hi Trapulo,

                    Sorry for keep you waiting. I've just got some further feedback from some
                    other product team engineer. However, they also think this could be some
                    mime-type settnig that Google earch will register it on the machine when
                    being installed. Here is the original message from some IIS experts:

                    =============== ======
                    it sounds as if Google Earth is adding a file extension assocation to the
                    client and then mapping the MIME type to that file extenstion and therefore
                    Google Earth

                    when receiving a response IE will refer to this list to determine if the
                    content needs to be passed to another application

                    you can check the file assocations through Windows Explorer in the Tools,
                    Folder Options, File Types menu

                    it looks as if the MIME type to file extension mappings are stored in the
                    registry


                    you should therefore be able to search the registry for
                    application/vnd.google-earth.kml which should link to a file extension and
                    then confirm that this file extension is mpaped to Google Earth

                    not sure how you would override this though as you are using Google Earh
                    MIME type which would reasonably be expected to link to Google Earth
                    =============== =======

                    Sincerely,

                    Steven Cheng

                    Microsoft MSDN Online Support Lead



                    This posting is provided "AS IS" with no warranties, and confers no rights.


                    Comment

                    • Trapulo

                      #11
                      Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....

                      Hello again Steven,
                      in fact I found that I have a ".kml" key in the registry of development
                      server. However, I've tried to create it on production server also, then I
                      restarted IIS, but it's still the same behavior :(

                      I also found a key in
                      HKEY_CLASSES_RO OT\Mime\Databas e\Content
                      Type\applicatio n/vnd.google-earth.kml+xml
                      I exported it and imported in production server, restarted IIS, but still
                      same.

                      It seems that IE WANTS to open the kml as an XML, despite of all other MIME
                      commands... :(


                      "Steven Cheng[MSFT]" <stcheng@online .microsoft.comw rote in message
                      news:eFtb0KH4GH A.4916@TK2MSFTN GXA01.phx.gbl.. .
                      Hi Trapulo,
                      >
                      Sorry for keep you waiting. I've just got some further feedback from some
                      other product team engineer. However, they also think this could be some
                      mime-type settnig that Google earch will register it on the machine when
                      being installed. Here is the original message from some IIS experts:
                      >
                      =============== ======
                      it sounds as if Google Earth is adding a file extension assocation to the
                      client and then mapping the MIME type to that file extenstion and
                      therefore
                      Google Earth
                      >
                      when receiving a response IE will refer to this list to determine if the
                      content needs to be passed to another application
                      >
                      you can check the file assocations through Windows Explorer in the Tools,
                      Folder Options, File Types menu
                      >
                      it looks as if the MIME type to file extension mappings are stored in the
                      registry

                      >
                      you should therefore be able to search the registry for
                      application/vnd.google-earth.kml which should link to a file extension and
                      then confirm that this file extension is mpaped to Google Earth
                      >
                      not sure how you would override this though as you are using Google Earh
                      MIME type which would reasonably be expected to link to Google Earth
                      =============== =======
                      >
                      Sincerely,
                      >
                      Steven Cheng
                      >
                      Microsoft MSDN Online Support Lead
                      >
                      >
                      >
                      This posting is provided "AS IS" with no warranties, and confers no
                      rights.
                      >
                      >

                      Comment

                      • Steven Cheng[MSFT]

                        #12
                        Re: Response.AddHea der(&quot;Conte nt-Disposition&quo t;....

                        Thanks for your reply Trapulo,

                        That does be abit strange. So currently you can only install Google Earth
                        on the server machine to make it work but haven't any other means to
                        manually duplicate the configuration Google Earch does? Can you confirm
                        the behavior on some other test server? If this does be a common issue, I
                        would suggest you consider contact CSS for further troubleshooting on this.
                        So far what I can get are limited to the client-side file type mappings
                        and the server-side mime-type mappings.


                        Sincerely,

                        Steven Cheng

                        Microsoft MSDN Online Support Lead


                        This posting is provided "AS IS" with no warranties, and confers no rights.

                        Comment

                        Working...