Just creating a link to the file is simpler, but try this...
Response.CacheControl = "no-cache"
Response.ContentType = "text/csv"
Response.AddHeader("Content-Disposition", " "filename=""" + _filename + """")
Response.WriteFile(_dirfilename)
Response.Flush()
Response.End()
The Response.End() should keep any other html from the calling page out.
On 7/14/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hey Dean,
>
> I am creating the file using System.Io. I create the file on the server then
> I loop thru my SQl table and then I do writeline to this file. If I look at
> the file on disk it is perfect. It has my headings and my data rows just
> like I want it. It is when the user downloads to their PC that it picks up
> the html. Here is my code that allows them to download:
>
> Response.AddHeader("content-disposition", "attachment; filename=""" +
> _filename + """")
> Response.ContentType = "text/csv"
> Response.WriteFile(_dirfilename)
>
> _dirfilename is the path and file name. So if I understand you correctly, I
> am creating the file on the server properly. It is when the user downloads
> where it is messing up.
>
> Thanks,
> Bob
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/