This code has just done exactly what I want it to on my PC at home.
Brilliant!! When I tried it in work earlier it wasn't working. Why? What
could stop it working on some browsers?
Private Sub Page_Load (ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Create a stringbuilder to hold the text to be sent
Dim sb As New System.Text.StringBuilder
' Add the text content to the stringbuilder
sb.Append("<?xml version=1.0 encoding=UTF-8 ?>" & vbcrLf)
sb.Append("<configuration>" & vbcrLf)
sb.Append("</configuration>" & vbcrLf)
' Set the appropriate ContentType.
Response.ContentType = "text/xml"
' Add a header telling the browser
' to expect an attachment and give it the
' name of the attachment
Dim filename As String = "license.xml"
Response.AddHeader("Content-Disposition", _
"attachment; filename=""" & filename & """")
' Write the file's content from the stringbuilder
' directly to the HTTP output stream.
Response.Write(sb.ToString)
Response.End()
End Sub
"Patrice" <no****@nowhere.com> wrote in message
news:O%****************@TK2MSFTNGP09.phx.gbl...
In case you missed my message :
http://support.microsoft.com/kb/260519/en-us shows how to raise the "save
as" box.
Addtionaly use just Response.Write to write down the file content (client
side the browser doesn't know where the content comes, it just see
incoming
bytes). The article is for ASP but applies as well to ASP.NET...
Patrice
--
"Russ Green" <rg*******@spam-stubbsrich.com> a écrit dans le message de
news:u$**************@tk2msftngp13.phx.gbl... Well what I'm actually trying to do is generate a license file for a user
to download. The content will be unique to any particular user. I want that
user to login to my site. Click a link and be presented with a dialog for
them to download their very own unique license file. I've seen it done
before.