Streaming a dynamically created xml file (using memorystream) to let the client application pick it

S

SuperKhoolGuy

Guys,

I have a client tool which runs and accepts files with "amt"
extensions. All the "amt" files have been setup to open using my
client tool which works great when I double-click on the file in the
windows explorer.

The way I'm creating the file is completely dynamic depending on the
user's options. Once this memory stream has been created, I'm
rendering on the screen.

This is where the problem is: The user sees the usual dialog which
says,

===========================================
'Some files can harm your computer, If the file information below
looks suspicious, or you do not fully trust the source, do not open or
save this file.

Filename: commands.amt

File Type: XYZ Company's Document Handler

From: localhost

Would you like to open the file or save it to your computer?'

[OPEN] [SAVE] [CANCEL]
[More Info]
=============================================

This is the problem. I don't want to let the user click 'Open' every
time this happens and this happens quite a number of times in a day.

QUESTION:
----------------
How can I let my client tool pickup my "amt" file automatically
without the user having to click 'Open' every time?

I'm also including the different solutions I tried.

-=================================BEGIN==============================
public void StreamMemoryStreamToClient(MemoryStream ms)
{
if (ms == null)
return;

//myPage.Response.ClearHeaders();
//myPage.Response.ContentType = "application/amt";
myPage.Response.Clear();
//myPage.Response.OutputStream.Write(ms.GetBuffer(), 0,
ms.GetBuffer().Length);
myPage.Response.AddHeader("content-disposition",
"attachment; filename=commands.amt");
myPage.Response.BinaryWrite(ms.GetBuffer());
//string newWindowScript = "<script language=JavaScript> "
+ script + " </script>";
myPage.Response.End();
}
-=================================END==============================

Environment: ASP.NET 2.0, windows client tool, IIS 5.0, Windows 2000.

Thanks for the help!

SuperKhool
 
M

Marc Gravell

It sounds like the client's "Confirm open after download" setting
against the file type in the registry; try editing this manually
(Tools->Options->File Types in explorer, find yours, Advanced). You
may need to deploy a change to the EditFlags setting?

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top