WebBrowserControl and csv files

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

    #1

    WebBrowserControl and csv files

    If I navigate to say http://Site/filename.csv, the web browser control
    or IE displays an excel sheet with the data in it. (Safari displays the
    raw text).



    This is not what I want. I want to get hold of the data and crunch it.
    How do I do this ? (or alternatively download the csv file which is
    pointed to by a hyperlink).



    Thanks.


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: WebBrowserContr ol and csv files

    Ian,

    You would have to add a content-disposition header on the server,
    indicating that it is an attachment, along with the filename. You can do it
    in ASP.NET like this:

    Response.Append Header("Content-disposition", "attachment ; filename=my.csv ");


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m


    "Ian Semmel" <anyone@rocketc omp.com.auwrote in message
    news:5309892ED0 E548C0A9416C12B B48C21A@DIMITY. ..
    If I navigate to say http://Site/filename.csv, the web browser control or IE
    displays an excel sheet with the data in it. (Safari displays the raw text).

    This is not what I want. I want to get hold of the data and crunch it. How
    do I do this ? (or alternatively download the csv file which is pointed to
    by a hyperlink).

    Thanks.

    Comment

    • Ian Semmel

      #3
      Re: WebBrowserContr ol and csv files

      Unfortunately it's not my server. It's a public download site and I just
      wanted to automate it.

      Basically, I want to get hold of the file (or text) which the WebBrowser
      has downloaded before it displays it.
      -----Original Message-----
      From: Nicholas Paldino [.NET/C# MVP]
      [mailto:mvp@spam .guard.caspersh ouse.com]
      Posted At: Thursday, 6 December 2007 11:56 AM
      Posted To: microsoft.publi c.dotnet.langua ges.csharp
      Conversation: WebBrowserContr ol and csv files
      Subject: Re: WebBrowserContr ol and csv files
      >
      Ian,
      >
      You would have to add a content-disposition header on the server,
      indicating that it is an attachment, along with the filename. You can
      do it
      in ASP.NET like this:
      >
      Response.Append Header("Content-disposition", "attachment ;
      filename=my.csv ");
      >
      >
      --
      - Nicholas Paldino [.NET/C# MVP]
      - mvp@spam.guard. caspershouse.co m
      >
      >
      "Ian Semmel" <anyone@rocketc omp.com.auwrote in message
      news:5309892ED0 E548C0A9416C12B B48C21A@DIMITY. ..
      If I navigate to say http://Site/filename.csv, the web browser control
      or IE
      displays an excel sheet with the data in it. (Safari displays the raw
      text).
      >
      This is not what I want. I want to get hold of the data and crunch it.
      How
      do I do this ? (or alternatively download the csv file which is
      pointed
      to
      by a hyperlink).
      >
      Thanks.

      Comment

      • Nicholas Paldino [.NET/C# MVP]

        #4
        Re: WebBrowserContr ol and csv files

        Ian,

        Well, you could use the HttpWebRequest/HttpWebResponse classes to
        download the content directly from the server out-of-band of the WebBrowser.
        Perhaps this will give you what you want?


        --
        - Nicholas Paldino [.NET/C# MVP]
        - mvp@spam.guard. caspershouse.co m

        "Ian Semmel" <anyone@rocketc omp.com.auwrote in message
        news:B302BF493A A5408BB642E99A5 548E2E3@DIMITY. ..
        Unfortunately it's not my server. It's a public download site and I just
        wanted to automate it.
        >
        Basically, I want to get hold of the file (or text) which the WebBrowser
        has downloaded before it displays it.
        >
        >-----Original Message-----
        >From: Nicholas Paldino [.NET/C# MVP]
        >[mailto:mvp@spam .guard.caspersh ouse.com]
        >Posted At: Thursday, 6 December 2007 11:56 AM
        >Posted To: microsoft.publi c.dotnet.langua ges.csharp
        >Conversation : WebBrowserContr ol and csv files
        >Subject: Re: WebBrowserContr ol and csv files
        >>
        >Ian,
        >>
        > You would have to add a content-disposition header on the server,
        >indicating that it is an attachment, along with the filename. You can
        >do it
        >in ASP.NET like this:
        >>
        >Response.Appen dHeader("Conten t-disposition", "attachment ;
        >filename=my.cs v");
        >>
        >>
        >--
        > - Nicholas Paldino [.NET/C# MVP]
        > - mvp@spam.guard. caspershouse.co m
        >>
        >>
        >"Ian Semmel" <anyone@rocketc omp.com.auwrote in message
        >news:5309892ED 0E548C0A9416C12 BB48C21A@DIMITY ...
        >If I navigate to say http://Site/filename.csv, the web browser control
        >or IE
        >displays an excel sheet with the data in it. (Safari displays the raw
        >text).
        >>
        >This is not what I want. I want to get hold of the data and crunch it.
        >How
        >do I do this ? (or alternatively download the csv file which is
        pointed
        >to
        >by a hyperlink).
        >>
        >Thanks.
        >

        Comment

        • Ian Semmel

          #5
          Re: WebBrowserContr ol and csv files

          Perfect ! Thanks
          -----Original Message-----
          From: Nicholas Paldino [.NET/C# MVP]
          [mailto:mvp@spam .guard.caspersh ouse.com]
          Posted At: Thursday, 6 December 2007 2:22 PM
          Posted To: microsoft.publi c.dotnet.langua ges.csharp
          Conversation: WebBrowserContr ol and csv files
          Subject: Re: WebBrowserContr ol and csv files
          >
          Ian,
          >
          Well, you could use the HttpWebRequest/HttpWebResponse classes to
          download the content directly from the server out-of-band of the
          WebBrowser.
          Perhaps this will give you what you want?
          >
          >
          --
          - Nicholas Paldino [.NET/C# MVP]
          - mvp@spam.guard. caspershouse.co m
          >
          "Ian Semmel" <anyone@rocketc omp.com.auwrote in message
          news:B302BF493A A5408BB642E99A5 548E2E3@DIMITY. ..
          Unfortunately it's not my server. It's a public download site and I
          just
          wanted to automate it.

          Basically, I want to get hold of the file (or text) which the
          WebBrowser
          has downloaded before it displays it.
          -----Original Message-----
          From: Nicholas Paldino [.NET/C# MVP]
          [mailto:mvp@spam .guard.caspersh ouse.com]
          Posted At: Thursday, 6 December 2007 11:56 AM
          Posted To: microsoft.publi c.dotnet.langua ges.csharp
          Conversation: WebBrowserContr ol and csv files
          Subject: Re: WebBrowserContr ol and csv files
          >
          Ian,
          >
          You would have to add a content-disposition header on the
          server,
          indicating that it is an attachment, along with the filename. You
          can
          do it
          in ASP.NET like this:
          >
          Response.Append Header("Content-disposition", "attachment ;
          filename=my.csv ");
          >
          >
          --
          - Nicholas Paldino [.NET/C# MVP]
          - mvp@spam.guard. caspershouse.co m
          >
          >
          "Ian Semmel" <anyone@rocketc omp.com.auwrote in message
          news:5309892ED0 E548C0A9416C12B B48C21A@DIMITY. ..
          If I navigate to say http://Site/filename.csv, the web browser
          control
          or IE
          displays an excel sheet with the data in it. (Safari displays the
          raw
          text).
          >
          This is not what I want. I want to get hold of the data and crunch
          it.
          How
          do I do this ? (or alternatively download the csv file which is
          pointed
          to
          by a hyperlink).
          >
          Thanks.

          Comment

          Working...