WebBrowserControl and csv files

I

Ian Semmel

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

Nicholas Paldino [.NET/C# MVP]

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.AppendHeader("Content-disposition", "attachment; filename=my.csv");


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


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

Ian Semmel

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

Nicholas Paldino [.NET/C# MVP]

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]
- (e-mail address removed)

Ian Semmel said:
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:[email protected]]
Posted At: Thursday, 6 December 2007 11:56 AM
Posted To: microsoft.public.dotnet.languages.csharp
Conversation: WebBrowserControl and csv files
Subject: Re: WebBrowserControl 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.AppendHeader("Content-disposition", "attachment;
filename=my.csv");


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


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

Ian Semmel

Perfect ! Thanks
-----Original Message-----
From: Nicholas Paldino [.NET/C# MVP]
[mailto:[email protected]]
Posted At: Thursday, 6 December 2007 2:22 PM
Posted To: microsoft.public.dotnet.languages.csharp
Conversation: WebBrowserControl and csv files
Subject: Re: WebBrowserControl 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]
- (e-mail address removed)

Ian Semmel said:
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:[email protected]]
Posted At: Thursday, 6 December 2007 11:56 AM
Posted To: microsoft.public.dotnet.languages.csharp
Conversation: WebBrowserControl and csv files
Subject: Re: WebBrowserControl 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.AppendHeader("Content-disposition", "attachment;
filename=my.csv");


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top