Posts

Showing posts from November, 2014

how to fix the window.location.origin problem in Internet Explorer

In some JavaScript i used the window.location.origin statement to build an url. It worked fine on every browser except the Internet Explorer. Whenever I tryed to call the origin an 'undefined' was the result. After some trys I figured our there is a workaround to build your own origin. 1 2 3 if ( ! window .location.origin) { window .location.origin = window .location.protocol + "//" + window .location.hostname; }

solve the FileNotFoundException for the iTextSharp.dll on Windows Server 2008 R2

In a previous post I wrote a little function to convert HTML to PDF. I wanted to use this function on a server and start it with an event. The silly thing was that nothing happened. Later I figured out that the program crashed. It threw a  FileNotFoundException with the statement "PublicToken = 8354ae6d2174ddca", but the DLL was there and the reference was correct too. Soooo I had to figure out why the error appeared.. It took a wohle day, but now I can present a solution. The architecture of a server stores assembleys in a Global Assembley Chache (GAC) to use them. So the server was looking for the assembley in the GAC and that is why the server was not able to find it. Right now the FileNotFoundException seems to be logic.

Add external tools to Visual Studio

Image
External tools in Visual Studio are great "Add-Ons". There are so many usefull tools, you just need to know them. For example you can create .NET classes out of XML-Shemas(XSD) or add DLLs to the Global Assembley Cache (GAC) of a server. To configure an external tool you need to call Visual Studio 2010 or above. Press "Tools" and go to "external Tools...". A mask appears.

convert HTML to PDF in C#

To convert a HTML file into a PDF file in C# is not as hard as it sounds. All you need is a usefull library, and there are many. For example you can use iTextSharp. This one is for free until version 4.1.6 and you can get it here .