Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

ASP NET WEB SERVICE RETURN FILE

Hi,

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.

thanks
0
kinton
Asked:
kinton
  • 2
1 Solution
 
nayernaguibCommented:
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
0
 
nayernaguibCommented:
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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now