Helpful Information
 
 
Category: ASP Programming
Calling a DLL that writes a file from ASP

Hello,

I call a DLL that writes a file. The DLL is written in VB and it behaves correctly when called from within VB. When I call it from ASP, it generates no errors, returns the correct results but does NOT create the output file!

The virtual directory of the page from which I call the DLL has Write permission.

Can anyone help me with this?

The details you have given are probably not enough to solve your problem.

Do you mean that directory where the virtual directory on the webserver is mapped to has write permission for the user the webserver is running as. I'm not 100% sure about IIS and security myself but I do know that the webserver usually runs as its own Windows User usually something like "IUSER" with a prefix for the machine name or something. This is the user account that must have the write permissions.

Also another possible cause of the failure to write is that in VB the evironment sometimes (i think there is a checkbocx somewhere) automatically registers the DLL for you. Are you sure the dll is actually running. You may have to register the dll using regsvr32 c:/mydir/mydll.dll

You may want to make a dll that does nothing but return 42 and see if that works from ASP. If so then its getting registered properly.

If none if that helps I would check the directory that you think you are trying to write to. You are probably trying to write to the C: drive of the machine the webserver is on, in that case you can use server.MapPath("fred.txt") which should end up in the root of the virtual directory of you website.

I this doesn't work my final suggestion would be save a file with the DLL using a file name (without the server.mappath) like "fredofrog.txt" and search all you drives for that file an see where it turns up!

This problem is also one that I have encountered, I need to be able to extract files from an archive for processing on my web site, but I can not get the files saved. From my research into this problem, I have found that it is related to IIS hotfix, which is also included in SP4 (W2K), this seems to block file writes from within COM DLLs. I am researching a fix, will keep you informed as to my progess...










privacy (GDPR)