Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / May 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SuperKhoolGuy@gmail.com - 29 May 2007 00:58 GMT
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
Marc Gravell - 29 May 2007 05:18 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.