I'm trying to generate a text file and make it downloadable for users, I did look at a standard Response.Write file using headers etc but this made IE crash. Somebody has since pointed me in the direction of ASHX files, however I'm still having a few hitches.
I had a look around and managed to find a couple of thread giving examples for ASHX and I tried to put one together in the following way: Added an aspx file, renamed it to be an ashx file with the following code: <%@ WebHandler Language="VB" Class="MailMergeDownloader" %> Imports System Imports System.Web Public Class DownloadHandler Implements IHttpHandler Public Sub ProcessRequest(ByVal context As HttpContext) _ Implements IHttpHandler.ProcessRequest Context.Response.ContentType = "text/text" Context.Response.AddHeader("content- disposition", "attachment; filename=Merge2.txt") Context.Response.WriteFile("C:\Temp\Merge.txt") End Sub ' Override the IsReusable property. Public ReadOnly Property IsReusable() As Boolean _ Implements IHttpHandler.IsReusable Get Return True End Get End Property End Class The only way I can get it to work is be calling the ashx file on a page load event of a blank aspx page by using response.redirect. The file downloads OK but the web page diplays an Action Cancelled message in IE. Is there anyway of avoiding this, I have a horrible feeling it is something simple that I am missing? Any help would be greatly appreciated! Thanks Colin You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.