Quote of the day

About Me

Thursday, October 8, 2015

Solved !!! - Integrate lotus notes to third parties APP using interop.domino.dll COM API using C#

First of all before writing anything about this integration, i would like to say, i tried...tried..tried...so many times using the COM but couldn't succeeded and there were lot of things which needed to be understood just to make it work, Also the question i had was there is no documentation on IBM for C# COM API, but a good documentation on JAVA and C , so i was also not sure if this DLL would work? or we need some other way like ODBC or xPages or Webservice etc?

But i think "In IT, you should read your intuitions, that is where answer lies, because they are shouting from your experience.", Because i noticed that DLL has all the required classes and properties etc. and it has same methods as shown in JAVA docs on IBM, so i was sos sure this is the DLL that would 200% work

(i went into this thought process because i tried for 3 days without any luck, and later i found domino also has a web service which can be generated from domino designer etc., if i would have gone on that path, i might needed to understand it differently, but i had full trust on my intuition that this DLL has everything and if i make it work and get rid of the error, we are good to go)

just because it was a new system to me and i had no clue what is wrong, but i will try to put everything in here, So anyone out you can also get some information :), I will list down the issues that i faced, what one needs to do to solve, and also let me give you the URL of the code project which sample i used to have that interop.domino.dll, it is here, it is very good sample.

The error while initializing NotesSession class
Retrieving the COM class factory for component with CLSID {29131539-2EED-1069-BF5D-00DD011186B7} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

Above is the error i was getting no matter what i do, even if build the app using 32 bit or 64 bit but i was just was not getting rid of that error message and which took a lot of energy out of me, so if you get this error, just skip directly to the SOLUTION section :(

So my first goal was just to get rid of this error and the other challenge was to understand the classes and their properties inside it and methods available etc. but first goal was to get rid of this error, as i never saw lotus notes,i tried to install the latest "Lotus notes client" to see what it contains and what are the terminologies etc. and suddenly my above error just vanished without doing anything, before that i tried to register the class, tried to register the DLL etc but it just did not work, but now it worked and there was no run time error, i was puzzled, Later in my research i realize that even if you have interop.domono.dll referenced in your project, you still need "Lotus notes client" installed on the machine or the server from where you are making a call top lotus notes server.

In order to execute your COM calls and use Notes classes inside it, you need to install "Lotus notes client" on that machine, Else it will keep giving you that Class not register error and you will end up going on that track of finding why it gives this error and registering it and 32 bit and 64 bit hell, and by the time you realize you would be on totally another track of the problem solving :).

The goal of this post was just to let you know that even if you have interop, you still need lotus notes client installed, Code samples you can get it from IBM's java examples, sames classes are available in interop.domino.dll

Wednesday, August 5, 2015

HTTP Error 500.19 - Internal Server Error, 0x80070021 while browsing your web app

Hello :) This is a quick draft as i faed this issue many times and every time i wondered what is the actual solution to it, is it something needs to be changed on web.config? or needs to be changed something in upper level config files as i was getting the same answer from everywhere

But the thing is why it works in other fresh machine with same configuration and why not on this? possible solution are below (apart from changing on config file level or unlocking config elements)
  • If you are using WCF make sure you have turned on the feature called "http activation" is turned on - It worked for me
  • If you are using windows authentication, make sure it is installed and turned on
  • run "c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i"

I know there are many reason which can cause this but i just drafted which worked for me as i was working with windows auth and WCF so may be if you have the same kind of scenario, it might help without locking/unlocking things from web.config

Wednesday, April 2, 2014

Could not resolve mscorlib for target framework '.NETFramework,Version=v4.0'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted wcf update service reference issue

I am feeling little good about writing this blog as this might help many, as i searched for the suggestion on the net for couple of days but may be i didn't google it properly (I can not say google does not have solution :) ), but finally if ends well everything is well, i got the solution of this nightmare kinda issues

The Issue

I faced this issue and i saw on the net the plenty like me had the same issue, that one fine morning your service reference stopped updating, or you can't do anything with them, which were working fine earlier, You can't update service reference, you can't delete them, once you remove everything and give the reference again, the error fires back again and you can't repeat the same procedure of deleting and inserting the reference over and over

See the following screen shot

Above is the screen shot which i kept on getting and searched for the solution with best of my googling capabilities untill i got the solution which is below, Before that there were many solutions like the classe names which WCF (wsdl) generates were larger than 256 characters, But i could not use that solution for some reason, other solutions were re intalling some of the MS tools and re installing them, Below is the solution which worked for me and i am posting so other can also make use of it


Creating a batch file instead of manually adding service reference (WCF reference) will only generate the wsdl files which is required to access the data of it and functions inside it and via which the above error will be gone


set UIProjectServiceRefPath =..\..\MyApplication\ServiceReferences

set SVCUTILPATHValue =C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools

ECHO Generating CommonService.CS
"%SVCUTILPATHValue %\svcutil.exe" /o:"%UIProjectServiceRefPath %\CommonService.cs" /reference:"c:\MyDomainService\bin\Debug\Domain.dll" /serializer:Auto /edb /ct:System.Collections.Generic.List`1 /ixt  /namespace:*,MyService.CommonService http://localhost/MyService.BLL/CommonService.svc?wsdl

set /p delBuild=press any key to exit:

  • Create a .bat file (batch file) like above, very first line after echo is where you want to have those class files to be created, this would be same path where your WCF service reference were getting created, so replace your path having that in mind
  • Second Echo statement is your actual service file which you want to generate, now if you have 3 services, you will these type 3 echo statements with their respective paths, here /reference is any reference DLLs your WCF might be using, so give those DLLs path there, you can have multiple /reference nodes followed by one another
  • /namespace is via which you will be referencing your classes to create their objects, and .svc is your hosted WCF service, the path which you were using to add service reference.

Now remove your existing "Service reference" folder which you have generated from previous WCF manual add service reference from windows explorere and also from your solution, and doucle click this file, it will generate "ServiceReference" folder at the smae place and inside that it will put above .CS files which is in .dat file

Your are good to go, go to your solution include this folder and build your project, if you have configured it properly it will build with no error, and now whenever you want to update the service reference, just double click this file to generate new WSDLs

Feel free to comment here in case of any doubt, I would like to mention here the valuable help from http://k-sharp-net.blogspot.in/ (Kamlesh samnani, very good colleague of mine)

Friday, March 28, 2014

401.1 Unauthorized with windows authentication error code 0xc000006d

How many of you have faced this hosting issue when you do everything what it takes to run the site with windows authentication but still you are getting the same error again and again?

If you think you also have faced the same issue and you tired of reading MSDN KBs for it and still have not found the issue (If KB has solved the issue, well and good, if not you can try this trick),Please Read below

Typical scenario

In typical hosting with IIS, i did every possible things like enabling windows authentication, changing it in web.config, configuring connection pool, authorization rules, it asks me for window authentication login and despite of entering correct credentials it always fails and keeps on asking for login, and when pressed cancel it gives 401.1 with 0xc000006d error code

Solution (Which worked for me at-least after trying for almost 6-9 hrs)

You need to change the Loop Back Check in registry so that it allows the host names which you are giving in url are allowed and authorized, Following are the steps

  • The solution is some registry hacking to avoid loopback check:
  • Using regedit, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
  • Add a new Multi-String Value to MSV1_0 and name it BackConnectionHostNames
  • Add the host names you wish to use. In my case, "test.mytestsite.com".
  • Restart the IIS.

I got this important information from http://falunbyday.blogspot.in/2013/02/windows-authentication-fails-on-local.html,It was life saver

Thanks, Enjoy

Thursday, March 13, 2014

File upload reference on client side for client side processing like crop image or anything

I have had a requirement were i needed to include the crop functionality in already developed file upload control, requirement was user should be able to crop the images he selects and later on when he finalize the selection, and that file should get saved on server so next it is available to user
Here our tradition approach is always like, we upload the file on server on some temporary location, so that it is available for cropping to user, and he can apply cropping on client side and send that to server with its crop selection and on server side we can process that image and crop on server side with already uploaded image and save so only cropped version will be saved and use that image
There is another approach which can save us from doing the upload first, crop and later on again save that image, the process is like following, Find the following code

Consider following is my upload control

Now,Consider following javascript registered which will take the file reference on client side and return the byte array of image and directly show in preview on the fly and very fast, as it is yet not uploaded on server, so process is very fast

function getImageFromClientSide(file) {

    var reader = new FileReader();
    var image  = new Image();
    reader.onload = function(_file) {
    image.src    = _file.target.result;              
    image.onload = function() {
           var w = this.width,
           h = this.height,
           t = file.type,                           
           n = file.name,
           s = ~~(file.size/1024) +'KB';
$("#imgSelector").change(function (e) {


As you can above, what it is using is FileReader method of DOM and reading a file from client's computer, and it will convert image into byte array of base 64, now you can treat this as a string and you can send this image to server side using ajax or anything as a string, and on server side (i am using asp.net c#, and you can use following

byte[] imageBytes = Convert.FromBase64String(imageByteArray); // Here imageByteArray is my string variable which contains the byte array string sent from client side 
   TypeConverter tc = TypeDescriptor.GetConverter(typeof(Image));
   Image OriginalImage = (Image)tc.ConvertFrom(imageBytes))

As this whole process is working on client side, this is very fast in performance, I got the reference of my search and r&d from http://jsbin.com/oTAtIpA/490/edit url and i implimented it from the same, i hope this will help some of you coders
Thanks you !!!

Friday, March 15, 2013

Same old file reference in project when 'Add reference' issue

Here is the "STUPID" scenario i came across,Following is the problem i had

I had one folder in my computer and it had two different version of dlls,My project already had reference of one of the dll,But now i wanted the reference of other dll,I simply deleted the old reference and tried to add new reference of the other file by selecting it,It was added but was showing old version when i tried to see its property ,I tried multiple times with multiple ways but no luck


First just check out the folder structure i had in my project,Here "Dlls" is the folder from which i wanted to add another file

You can see the "Dlls" folder is included in the project, And thanks to "Mr. Zakir Rana", One of project partner who insisted me to try excluding this folder and adding reference, It sounded foolish to me as its physical folder after all no matter if it is included or not,But i was surprised as soon as i excluded the folder,And it started taking new reference !!!

Wednesday, February 20, 2013

Ajax call inside for loop issue and solution

Hello people, This post is regarding real day to day issue in coding and its resolution, It sometimes looks small issue but when it starts eating your time you start getting feeling that its no more smaller one, Here goes the issue

As the title of the blog suggests, When you are making AJAX calls inside loop, It is finitely possible that inside loop when the call is made, It takes time to get the result back to client side and by that time loop has already ended and counter has reached to limit and you end up thinking how to keep track of the request, it should get the correct index in "Success" method of $.ajax call, Otherwise it will keep on giving you one count higher than your total count of loop, There can be many way as we know in our world but below is one of the good solution to it

See below code for an example

for (var i = 0; i < groupCount.length; i++) 
                !function (i) {
                        type: 'POST',
                        url: ,
                        data: data,
                        dataType: "json",
                        success: function (respons) {
                            // Do some action
                        error: function (err, para1, parra2) {
                           // Do some action 
                } (i);

Here we can see we have wrapped the ajax call into !function(), It will make sure that your ajax call works, no matter what !!!, One more dirty fix is that we can change the property called async=false in $.ajax parameters but that does not serve the purpose as when we use ajax it has to be async.

Small but helpful !!!