why not just use:
response.redirect("myfile.txt")
I'm missing something, I'm sure.

Signature
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
> I am trying to download a text file that my .NET page has just created based
> on entered parameters on the web page. Everything seems to work and the file
[quoted text clipped - 21 lines]
> Tom Youngquist
> Tom_Y@ix.netcom.com
RiteshDotNet - 28 Jan 2005 15:49 GMT
<%@ Page language="VB" Debug="true"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
If Not IsPostBack Then
Dim PathVirtual as string = Request.QueryString("Filename")
Dim strPhysicalPath As String
Dim objFileInfo As System.IO.FileInfo
Try
strPhysicalPath = Server.MapPath(PathVirtual)
'exit if file does not exist
If Not System.IO.File.Exists(strPhysicalPath) Then Exit Sub
objFileInfo = New System.IO.FileInfo(strPhysicalPath)
Response.Clear()
'Add Headers to enable dialog display
Response.AddHeader("Content-Disposition", "attachment;
filename=" & Request.QueryString("filename"))
'objFileInfo.Name)
Response.AddHeader("Content-Length",
objFileInfo.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(objFileInfo.FullName)
Catch
'on exception take no action
Finally
'System.IO.File.delete(strPhysicalPath)
'Response.End()
End Try
End If
End Sub
sub funclose(obj as object, e as eventargs)
try
Dim PathVirtual as string = Request.QueryString("Filename")
Dim strPhysicalPath As String
strPhysicalPath = Server.MapPath(PathVirtual)
System.IO.File.delete(strPhysicalPath)
catch
End try
Response.Write("<script language=javascript>" & vbcrlf)
Response.write("self.close();" )
Response.Write("</" & "script>")
End Sub
</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form runat="server">
<table width="100%" border="0"><tr><td align="center"
width="100%"><asp:button id="btnclose" OnClick="funclose" text="Close"
runat="server"/></td></tr></table>
</form>
</body>
</html>
Find Code
> why not just use:
> response.redirect("myfile.txt")
[quoted text clipped - 31 lines]
> > Tom Youngquist
> > Tom_Y@ix.netcom.com