my dotnenuke custom module has to download a text file. This is what I am doing:
string
path = base.MapPath(base.ModulePath);
string user = GetCurrentUser();
StreamReader reader = new StreamReader(path + "template.txt");
string buddyDocument = reader.ReadToEnd();
reader.Close();
buddyDocument = buddyDocument.Replace("___LOGIN___", user);
Response.Clear();
Response.ContentType = "text/plain";
Response.AddHeader("Content-disposition:", "attachment;filename=List.txt");
this.Response.Write(buddyDocument);
Response.Flush();
this.Response.End();
Response.Close();
I do get a dialog box asking if I want to open or save the file. If I select save it works fine. If I select to open I get a message saying:
Cannot find the C:\Document and Settings\<user>\Local Settings\Teomporary Internet Files\Content.IE5\<directory>\List[1].txt file. Do you want to create a new file?