Tag Archives: .net

How to open a new tab in an existing Internet Explorer instance in C#

A problem that I recently came across is when opening a new Internet Explorer instance in C# the user was being required to login to a site that they had already logged in to. It was pretty clear that this was because the existing session was not being used as a new IE process was being started, therefore I surmised that the solution was to utilise the existing process.

I had read previously about the Navigate2 API and thought it may help but it wasn’t entirely clear how to use it and specifically how to use it on an existing IE instance, so I feel this blog may help others.

Continue reading How to open a new tab in an existing Internet Explorer instance in C#

How to save to PDF in C# using Word 2003 or 2007 without SP 2 (using Pechkin)

I’ve spent a significant amount of time lately on trying to solve this issue and came across many, many barriers, so I thought I’d share with you my findings and the solution that I used. Whilst Word 2007 SP2 (or Word 2007 using the Save As PDF Add-in) and above natively support saving documents as PDF (and can therefore be used by C# to save as if saving a normal .doc or .docx – you can do this easily by adapting my code) below this level it is not possible. There are a few different ways that this problem can be solved (notably, using a paid library or a web service) but most involve payment and some involve methods that, in my case, were not acceptable (e.g. having to install additional software or having to access locations that were locked down).

Continue reading How to save to PDF in C# using Word 2003 or 2007 without SP 2 (using Pechkin)

How to access WebAPI from a .Net 3.5 client in C#

So, like me, you may have come across some incompatibility within your WebAPI client that means you can’t use .Net 4/4.5 (which is required to use HttpClient and HttpResponseMessage etc.) – or you’re writing a web service to fill in due to this incompatibility. This solution should allow you to access your API (using POST) from .Net 3.5 (and above, maybe even below).

Continue reading How to access WebAPI from a .Net 3.5 client in C#