locked
Generate dynamic file RRS feed

  • Question

  • User-1918617911 posted

    Hi!
    How may I generate a text file with dynamic contents and send it to the client, at ASP.NET. For example, I desire each user may receive a text file containing the current date and time or the client IP address.
    As a solution, I created a Web Form and erased the whole contents. Then wrote the code such as:

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
            Response.ContentType = "Text"
            Response.Write(Date.Now.ToString)
        End Sub

    While loading the page, user would receive a text file containing the current date and time. But in this way, I cannot change the file name. The file would be downloaded to client as the Web Form name (e.g. "File.aspx").

    Much obliged to you for your great attention.

    Regards;
    M.Sadegh Samiei

    Sunday, November 6, 2005 2:02 AM

All replies