Posted on 2006-03-29
Last Modified: 2010-04-17

I have a DLL that my web service calls, this DLL will create a file on the fly, it may be a HTML file, XML file, text file etc.  In ASP.NET how can I simply get the webservice to open and display this file?  The DLL passes back the file path.

Question by:kinton
    LVL 14

    Accepted Solution

    In ASP .NET, you can both open and display the file using one method call.
    The method Response.WriteFile (string) opens the file whose name is specified as the string parameter, and outputs its contents to the user.


      Nayer Naguib
    LVL 14

    Expert Comment

    You can also do the following trick:

    If you have access to the source code of the DLL, you can simply have the DLL call return the file contents instead of the path to the file. Now you can directly display the file using Response.Write() method call.

    Otherwise, if you don't have access to the source code of the DLL, you can write a function (whether in another DLL or simply inside your ASP .NET project), that when called, will call the first DLL, open the file whose name is returned by that DLL, and return the file contents to the calling party as an array of bytes or characters, or as a string.


      Nayer Naguib

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    This article will show, step by step, how to integrate R code into a R Sweave document
    This is about my first experience with programming Arduino.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now