Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Build csv page in ASP.Net?


Message #1 by Philo <philo@r...> on Sat, 08 Jun 2002 13:58:49 -0400

What's the best way to build an entire page in code in ASP.Net? I want to 
return a .csv file, which means setting the MIME type and returning pure 
text, no headers.

In ASP I'd have an entire page surrounded by <% %> tags and everything 
would be response.write, but I'm not sure how that translates to .Net.

Anyone got a good example?

Philo

Message #2 by Adil Rehan <adilrehan@y...> on Sat, 8 Jun 2002 12:29:59 -0700 (PDT)
Hi Philo

You can use something like below ...

===========================
<%@ Page language="c#" %>
<script runat=server>
private void Page_Load(object sender, System.EventArgs e)
{
	Page.Response.ContentType = "some content type";
	.....
	Page.Response.Write("Write Content Here");
}

</script>
==========================

HTH

Regards,
Adil rehan

--- Philo <philo@r...> wrote:
> 
> 
> What's the best way to build an entire page in code in ASP.Net? I want to 
> return a .csv file, which means setting the MIME type and returning pure 
> text, no headers.
> 
> In ASP I'd have an entire page surrounded by <% %> tags and everything 
> would be response.write, but I'm not sure how that translates to .Net.
> 
> Anyone got a good example?
> 
> Philo
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
Message #3 by Feduke Cntr Charles R <FedukeCR@m...> on Mon, 10 Jun 2002 08:34:04 -0400
Philo,

	I do this with some of my stuff that creates images on the fly; I do
a Image.Save(Request.OutputStream, ImageFormat.Jpeg) and I'm sure you could
use a File's save method (or what have you) to .Save to the
Request.OutputStream.  Then just add the ContentType="text/csv" to your
@Page directive:

<%@ Page ... ContentType="text/csv" %>

	I have an example written for doing images on the fly if you'd like
it.

HTH,
- Chuck

-----Original Message-----
From: Philo [mailto:philo@r...]
Sent: Saturday, June 08, 2002 1:59 PM
To: ASP+
Subject: [aspx] Build csv page in ASP.Net?




What's the best way to build an entire page in code in ASP.Net? I want to 
return a .csv file, which means setting the MIME type and returning pure 
text, no headers.

In ASP I'd have an entire page surrounded by <% %> tags and everything 
would be response.write, but I'm not sure how that translates to .Net.

Anyone got a good example?

Philo



  Return to Index