We help IT Professionals succeed at work.


kinton asked
Medium Priority
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.

Watch Question

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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.