NTidy and ASP.Net
So I'm working on this asp.net project. We need rich text formatting for our customers. You know since they like to copy and paste from Word and what not. During the course of testing I discover malformed HTML, especially DIV tags bombs the app by closing our div tags before they are supposed to. So we decide we need to either prevent certain HTML or clean it before it gets saved to the DB. After some looking I find NTidy, a .net wrapper around Tidy a C/C++ HTML cleaner. You can download it from SourceForger here:
NTidy on SourceForge
I insert the dll into my project and get it running on my machine. Of course since its OSS no documentation( see my post below ) but I get it running. Soon we have clean valid HTML and no more malformations.
But today, disaster strikes, the production server hosting this bombs on our new build. It says it can't find needed assemblies for the damn NTidy dll. Enter google (how I love thee so), after a few hours I find an obscure post on the CodeProject.com about NTidy being used in some PDF Converter. Lo and behold there was a post warning about using NTidy and how it needs other dlls then the .NET framework.
To use Ntidy on a server where only The .Net Framework is installed, you must make sure that the following dlls are well present in C:/windows/system32:
- msvcp71d.dll ( Microsoft C++ Runtime Library )
- msvcp71.dll ( Microsoft C++ Runtime Library )
- msvcr71d.dll ( Microsoft C Runtime Library )
- msvcr71.dll ( Microsoft C Runtime Library )
You can get these files from a dev machine or by installing the .NET SDK onto your server. Either way your NTidy problems should be solved! The .NET redistributable package for some reason doesn't contain these dlls.
If you don't want to deal with this, I would suggest using SGML Reader, does a lot of what NTidy does but it is pure .NET. Of course I find NTidy to be a lot more powerful, it fixes things SGML Reader just errors out on.
Here is a brief update from our use of it
To use Ntidy on a server where only The .Net Framework is installed, you must make sure that the following dlls are present in C:/windows/system32:
- msvcp71d.dll ( Microsoft C++ Runtime Library )
- msvcp71.dll ( Microsoft C++ Runtime Library )
- msvcr71d.dll ( Microsoft C Runtime Library )
- msvcr71.dll ( Microsoft C Runtime Library )
If you don’t have those libraries, I’ve included them in the attached ZIP file. Just extract them and move them to the System32 folder. They don’t need to be registered or anything. As a further note to solve this problem I would just make sure you have the Microsoft Visual C/C++ runtime installed on any machine you plan on using NTidy with. This ensures you have all the dlls required and they are installed correctly on the target machine.
NTidy on SourceForge
I insert the dll into my project and get it running on my machine. Of course since its OSS no documentation( see my post below ) but I get it running. Soon we have clean valid HTML and no more malformations.
But today, disaster strikes, the production server hosting this bombs on our new build. It says it can't find needed assemblies for the damn NTidy dll. Enter google (how I love thee so), after a few hours I find an obscure post on the CodeProject.com about NTidy being used in some PDF Converter. Lo and behold there was a post warning about using NTidy and how it needs other dlls then the .NET framework.
To use Ntidy on a server where only The .Net Framework is installed, you must make sure that the following dlls are well present in C:/windows/system32:
- msvcp71d.dll ( Microsoft C++ Runtime Library )
- msvcp71.dll ( Microsoft C++ Runtime Library )
- msvcr71d.dll ( Microsoft C Runtime Library )
- msvcr71.dll ( Microsoft C Runtime Library )
You can get these files from a dev machine or by installing the .NET SDK onto your server. Either way your NTidy problems should be solved! The .NET redistributable package for some reason doesn't contain these dlls.
If you don't want to deal with this, I would suggest using SGML Reader, does a lot of what NTidy does but it is pure .NET. Of course I find NTidy to be a lot more powerful, it fixes things SGML Reader just errors out on.
Here is a brief update from our use of it
To use Ntidy on a server where only The .Net Framework is installed, you must make sure that the following dlls are present in C:/windows/system32:
- msvcp71d.dll ( Microsoft C++ Runtime Library )
- msvcp71.dll ( Microsoft C++ Runtime Library )
- msvcr71d.dll ( Microsoft C Runtime Library )
- msvcr71.dll ( Microsoft C Runtime Library )
If you don’t have those libraries, I’ve included them in the attached ZIP file. Just extract them and move them to the System32 folder. They don’t need to be registered or anything. As a further note to solve this problem I would just make sure you have the Microsoft Visual C/C++ runtime installed on any machine you plan on using NTidy with. This ensures you have all the dlls required and they are installed correctly on the target machine.
Comments
I've come across this problem previously as well and simply copying over the DLLs fixed the problem. However, I have now come across 2 machines (XP Pro and 2003 Server 64bit) when after copying over the files the same problem persists. Have you come across this and if so, how did you manage to solve it?
Man this brought back some old memories. As far as I know we just dropped the .dlls in the target machines system32 folder and it solved the problem. If that isn't working I would suggest installing the entire VC runtimes from microsoft and see if that fixes the problem. Also NTidy uses the 1.1 framework so make that is installed as well.
Honestly for the 64 bit machine I have no clue if this will work. I believe it should be the same but who knows. I honestly haven't dealt with the 64 stuff yet.
This really solved my problem, But only issue still i am not able to resolve is any app/dll which consumes Ntidy.dll don't work in release mode. Do you have any idea.
Thanks a lot !
-Mohan
It's been a while since I've used the dll but I don't recall us ever having any problems with it in release mode. Sorry I couldn't be of more assistance. Just make sure you have a valid reference to the dll in your project and you have the visual c/c++ run time installed.