Free Support Forum -

Javascript error



I am testing GroupDocs.Annotation as a possible solution for our company. I started setting up an empty .aspx website that runs on my local computer with iis7. I am now getting an javascript error with the following error message:

Unhandled exception at line 6, column 99443 in http://localhost/GroupDocs.AnnotationsTest/document-viewer/GetScriptHandler?name=GroupdocsViewer.all.min.js

0x800a138f - JavaScript runtime error: Unable to get property ‘code’ of undefined or null reference

I can send a screen-shot and a zip-file with the solution.

I hope you can point me in the right direction.


Robert Badi

Hello, Robert!

Thank you for your interest in GroupDocs. We are sorry to see that you have such issue.

Your project and screenshot will be very useful, without them it is hard to understand what is wrong.

As, for know we can only assume that your server requires authorization or the document is not loaded (some unpredictable server-side error).


Hello Ihor

The File attachment button does not work on your website to I am resorting to Here is the screenshot:

And here is the solution zipped:


Robert Badi

Thank you, Robert!

We will look at it and respond to you asap.

By the way, can you show a screenshot with the JavaScript error you get. If there are some errors in server logs, can you provide these too?

Also, it would be nice to know what environment you have.


Hello Robert,

We downloaded and reviewed your project. Here is a list what we had found:

1. web.config

1.1. You had specified HTTP-handlers only in system.webServer -> handlers section. This means that web-site will be working correctly only on IIS Integrated Mode and IIE Express.
1.2. You need to specify in the system.webServer section in order to display elements of toolbar properly.

2. Index.aspx

2.1. FilePath(“App_Data/Quick_Start_Guide_To_Using_GroupDocs.pdf”) is specified incorrectly because “App_Data” folder is already initialized as a “root storage path” in the Global.asax (Groupdocs.Web.Annotation.WidgetFactory.Initialize(this.Context, @"~/App_Data");). Thus GroupDocs.Annotation tries to find a document in the “App_Data/App_Data” subfolder and cannot find. So you need to use simple .FilePath(“Quick_Start_Guide_To_Using_GroupDocs.pdf”)
2.2. ToHtmlString() is useless because this method is invoked automatically while rendering a page.
2.3. DIV “annotation-widget” has incorrect style = “width: 100%; height: 100%;”. You cannot simple set a DIV height to 100%. So when you use height: 100% it does not matter what is inside this DIV - it wouldn’t be 100% height, only width. You can find more info here: Make div 100% height of browser window In order to make viewport 100% tall you need to set “height: 100%” for all parent elements. Another and much easier way - to set height in absolute points, pixels, for example:

If you will have more questions please feel free to contact us.


Dear Denis

Thank you for your reply. I followed your instructions but I still get one javascript error and not toolbar on the left side for annotations. I then compared my code with the demo for but am still at a loss. So I have recorded a screencast to show you. In it I first run the demo which works fine and then my solution and what happens when I run it. I also show the IIS settings.

Hope you have an idea what is wrong.

As point 1.1. I am running in integrated mode. If I add the handlers for classic mode also into web.config I get a server error.
As to point 2.2 ToHtmlString the demo has this and I can’t see that that makes any difference. Same goes for point 2.3, height is set to 100% in the demo, I changed that, but you might want to change the demo file if that is incorrect.

Here is the link to the screencast:

Here is the link to box with and updated solution if you need to see is also:

Best regards
Robert Badi


Hello Robert,

We downloaded and reviewed your updated project. Especially we want to thank you for detailed video screencast.

But first we will answer to your questions from previous post.
1. “If I add the handlers for classic mode also into web.config I get a server error.” - yes, this is default behavior. By default IIS raises an error when web.config is configured for both Classic and Integrated modes. But this can be fixed by using statement in the “system.webServer” node.
2. “ToHtmlString” in ASPX page (code-front) it is simply useless. It makes sense when you place a server control on the code-behind.

And now about your error. We could not reproduce the exact error that you have experienced. But the situation when left toolbar panel is absent is very common. It usually occurs when there is a discrepancy (mismatch) between data stored in the database and data stored in the “file-sessions.json” file in the “App_Data” folder.

In the “file-sessions.json” that is present in your project there is a line
“Quick_Start_Guide_To_Using_GroupDocs.pdf”: 2
In the code-behind (Index.aspx.cs) there is a adding collaborator "" procedure. It seems that due to data mismatch the user "" has no permission to add annotation to the document so that’s why toolbar is absent.
In order to fix it open your database (you are using SQL Server). In the “Users” table you should find "" - note his “Id”. Then go to the “Annotation” table. If it is not empty, for proper functioning there should be annotation record, where “AnnotationSession” should be “2” (from your “file-sessions.json”). “UserID” should be the same as "" has.

If “Annotation” table is empty or this guide will not help, simply remove all records from all tables within “GroupdocsAnnotation” database and also remove “file-sessions.json” file. Also remove all cache (“temp” folder in the “App_Data”). Then restart web-site. GroupDocs.Annotation will recreate file and begins to work “from scratch”.

Another little remark. In your web.config remove “GetPdf2XmlHandler” HTTP-handler (it is obsolete and doesn’t exist in GroupDocs.Annotation and add HTTP-handler

Hope this will help. If you will have more questions please feel free to contact us.


Hello Denis

Thank you very much for your reply. I have followed your suggestions and deleted the content of all the database tables in the GroupdocsAnnotation database, the file-sessions.json file and the temp directory from App_Data and restarted the website.

However the left toolbar panel still does not appear and there still seems to be a data mismatch after the recreation process. Please see the following screenshot of the data tables for your reference after the recreation process (deleting contents of tables and restarting web-site):

The contents of the file-sessions.json is the following:

“Quick_Start_Guide_To_Using_GroupDocs.pdf”: 10003

Best regards
Robert Badi


Hello Robert,

Hmmm, your error is pretty strange. Can you please make the following:

1. Do you see a popup message “There is no such reviewer” when page (“Index.aspx”) loading is completed?

2. Can you check a request/response scanner while page is loading? You can use for example Firebug, or “Net” tab in Google Chrome, or Fiddler2, for example. If all is fine then all requests/responses should be successful. Please take a look at all SignalR-related requests like:


Are all of them have HTTP 200 OK response? If all is fine you should get something like that:

Please come back to us with more details. Thanks.


Hello again Denis

I don’t get a popup message when loading the index.aspx page.

I do however get this 404 message:
  <td>199 B</td>
  <td>0.70 s</td>
URL Protocol Method Result Type Received Taken Initiator Wait‎‎ Start‎‎ Request‎‎ Response‎‎ Cache
This is the generated code line in Index.aspx:

I am going on holiday tomorrow for 2 weeks, so if we can't solve this in the next two hours I hope we can continue when I get back.

Robert Badi


Hello Robert,

Now the situation is much more clear. I can suggest that in the IIS you are using Virtual Catalog system for hosting this web-site, in opposite to the separate web-site. I think the error is because GroupDocs.Annotation forms the URL improperly. Take a look at full absolute URL that has 404 response - its domain name should differ from all other “200 OK” requests.
If this is true, just add to the HEAD section of your web-page a correct inclusion like this:

In that case you will overwrite the default incorrect inclusion by your own - correct.

Please try this and come back to us with results.


Hello Denis

I did that and I now have a line in IE’s Network Console for the new included script with a result of HTTP 200. A bit further down I have the other automatically generated call by Groupdocs still with the 404 result. I also still get the javascript errors as before.

Best regards
Robert Badi

P.s. See the following screenshots:


Hello again Robert,

SignalR is responsible for “annotation tools” left panel and that’s why it is not working for you - something blocks SignalR-related requests/responses. You stated at previous posts that you are using IIS. Maybe this is a reason. Now we need to narrow a set of all possible reasons that can lead to this error. So please try to launch your web-site not using IIS, but at this time use IIS Express or ASP.NET Development Server. It can be easily done if you use MS Visual Studio - go to the Properties - Web tab - Servers - > Use IIS Express. But, of course, don’t forget to remove the line that I suggested to you at previous post

because at this time domain name will be another.

Using that it will be able to define whether IIS is a reason of the error or not.


Hi Denis,

I also got almost the same issue when I tried to run the demo using MVC5, right now, when I starts my project in IIS Express, I will get an error of “there is no such viewer” and no annotation toolbar. If I starts my project on my local IIS server, I’ll get the exact same javascript error. So could you give me a runnable demo of ASP.NET MVC5, maybe this could help me identify the mistake I made. Thanks!


Hello Brian,

1. There is a package “GroupDocs.Annotation C# Demos” at our web-site. This is a demo solution which contains several projects, including WebForms and MVC. All these demos use SQL Server Compact as a storage, but it is very easy to switch this to the SQL Server.
2. GroupDocs.Annotation is compatible with all types of web-servers including IIS 6+, IIS Express and ASP.NET Development Server (Cassini). But when using IIS you need to perform additional actions like files/folders access etc. Also there are several specific problems like we discussed in previous posts. So my intention was to launch Robert’s project under IIS Express or Cassini in order to define a reason of error - is it Annotation-specific or IIS-specific.
3. “Uh-oh. There is no such reviewer” is not the same error as the previous that was described. When you see this message then SignalR is working; in opposite you will be not able to see this message. In fact this is not an error; this message says that current user is not registered as a reviewer. In order to fix this please clean your database and also remove “file-sessions.json” file. Also clean the browser cache and restart the web-site.

Hope this will help. If you will have more questions please feel free to contact us.


Hi Denis,

Thanks for your help, I’ve already fixed my problem, it’s caused by the wrong test account I used in my controller.

PS: I’m not Robert, I just had the same problem with Robert so I followed this case.

Hi Denis

I am now using IIS Express. The SignalR problem seems to be fixed so I commented out the code in the aspx file you recommened.

But I am still getting javascript error and nothing is being loaded.

Please see this screencast which I hope is helpful:

Robert Badi


Hello Robert,

We are sorry to hear that you have such issue.

Thank you for such detailed screencast. We assume that you are using the same test project that you have pointed here: ( We cannot reproduce now the exact error but we observe very similar client-side JS-related error. It occures only in Internet Explorer, in other browsers web-site works fine.

Here is a solution how to make it work in Internet Explorer:
1. Download the latest GroupDocs.Annotation for .NET version 1.4 from and replace old 1.3 library onto this new 1.4.
2. Add a <meta http-equiv="X-UA-Compatible"content=“IE=edge” /> line to the section of a “Index.aspx” page.

If you will have more questions please feel free to contact us.


Hello Denis

It seems that I have made some progress now. I changed the order of calls to js scripts and the WidgetFactory that now comes after jquery scripts.

Now however I always seem to have problems with the call to svc.AddCollaborator in the codebehind (I get an exception). It only works after I clean the solution but then I get an error “Uh-oh, something went wrong. There is no such reviewer.”. The net scanner in IE list the following call as pending, all others are 200 OK:

The [dbo].[Annotations] table is always empty even after deleting file-sessions.json file and temp folder in App_Data folder as you recommended previously.

Here below is a download link to my updated solution again and a link to a screencast demonstrating my problem. I hope you can take a look and see what is wrong now.

Best regards
Robert Badi


Hello Robert,

We are sorry to hear that you have such issue. We have downloaded and reviewed your project.

In this current case the error is because you need to use default user “”. Your database is empty, there are no users, so in order to allow anonymous users or guests make annotations you need to refer to the hardcoded "". So in the code-behind of the “Index.aspx” page please change
svc.AddCollaborator(_filePath, "", “FirstName”, “LastName”, null);
to the
svc.AddCollaborator(_filePath, "", “FirstName”, “LastName”, null);
Of course, database and “file-sessions.json” file should be empty.

If you will have more questions please feel free to contact us.