Dllimport from aspnet application hangs

What you will do when you do not get any error message but your web application simply hangs. That is what happened to me last week when I tried the following.

As our application design requires us to use one of the validation API engine which was written on C(so basically all I have is a dll) and I tested calling the functions using small windows application using DllImport for each functions and it works without any problem. But when I try to use the same Dll in my asp.net web application, it hangs with the first call which is init function call. I tried giving the dll path as a hardcoded path like C:\<application directory\bin>validation.dll in my dllimport funciton call but did not help. I am wondering it has something to do with ASPNET account security. So I gave full control for ASPNET account for my application directory and still my application hangs. I even tried copying the dll file into system32 directory but no hope.

Anybody faced this earlier?

5 Comments

  • I was also facing the same problem with one of my project when I have to use one ActiveX DLL function for some validation and its hang every time after that calling that function. I tried to create a window application to test that DLL, but it was working properly with that test bed. After some investigating, I found that there are some message boxes codded inside that ActiveDLL, for prompting user if there is any invalid data passed to that function :) and that was the reason of hanging up of my ASP.NET based project. I then remove all of the message box from the the used ActiveX DLL and make some modification in the source of the DLL so that its pass error message to ASP.NET project instead of displaying itself.



    See if this is the reason in your case.



    Regards



    Firoz



  • Indeed, any message box will hang the ASP/ASP.NET script engine.



  • Firoz,



    Thanks for your input. But my validation control does not show any messagebox in case of error but instead send me error string array if there is one. I tested this functionality in my Windows application and was able to get the error strings properly. Moreover I do not have any control on the source code of this dll.



    thanks

    Ram

  • did you look in the event viewer / application log? sometimes that has a more thorough description

  • Actually, I solved the problem. It has nothing to do with security which I came to know after series of debugging. It so happened that the first init function in the dll expects an filename parameter. For ASPNET application it expects that file also to be in system32 directory and as it was not found, the dll function still waits there and aspnet seems to be hanging. Once I try hardcoded the file name with pathname, it started working.



    thanks all for your input





Comments have been disabled for this content.