Answered by:
Possible C# and Javascript error - so confused

Question
-
I am not very familar with C# and Javascript. Our .net developer just left company and the new developer is not on board yet. So I have to deal with this issue myself. This issue is very strange that I cannot figure it out what is the problem.
My debugging enviornment:
. two Windows 2012 servers for hosting the .net applications, one for production and one for test. The application folder/files are extactly same (I copy the folder from one to another).
. both front-end server link to the same back-end SQL 2008 server;
. one windows 7 pc and one Widnows 2008 terminal server.
What happen:
. I used some user accounts to create an attendant calendar from both servers/sites without any issue.
. my own account and few others have problem in the production server but it is fine with the test server from the windows 7 pc ie.
. my account works fine on both servers from the terminal server ie.
. my account works fine on the production server on visual studio debugging mode.
. If I add a break point on line 486 and start debug
I received a javascript error of null reference, b = null. Line 487 and 489 do not cause the same problem
I do not understand how
(1) a C# assignment can call a javascript function?
(2) why it works on one server but not in another although have same application folder/files.
(3) why it works on terminal server ie but not in windows 7 ie.
(4) It also works fine on production server which gave me problem on debugging mode without the break point. why is there a different if I add the break point.
I just wonder if there a way I can escape the javascript error for now and wait the new .net developer to take care it. I really appreciate any help.
- Moved by Caillen Monday, January 19, 2015 3:21 AM
Saturday, January 17, 2015 5:27 PM
Answers
-
It is more likely a browser compatibility issue. I added the site to the compatibility view. The problem seems go away.
- Marked as answer by eg10013 Wednesday, January 21, 2015 5:28 PM
Wednesday, January 21, 2015 5:27 PM
All replies
-
Hello,
an c#-App cann call a JavaScript-function by invoking it. For example by using this Method in c#: Invoke(...)
the Exceptions means that the variable "b" is null. You could prevent the error by adding some lines before the code:
if(b == null) //If b is NULL, i CAN NOT contain "ns6" of course. return false;
A reason why this code works on the Server but not on your computer might be a missing header or dynamic content. Sometimes the Server returns the HTML-Code and some Headers (HTTP Header). Or the website loads content dynamical.
Sorry for my grammar mistakes i perhaps maked. I'm a german. :)
© 2015 Thomas Roskop
- Proposed as answer by Thomas Roskop Wednesday, January 21, 2015 5:32 PM
Saturday, January 17, 2015 6:31 PM -
Thanks Thomas for your response. Your grammar is fine.
I follow your instruction to modify the javascript by check the if b == null. Now I have no problem with the break point on debugging mode. However, I still has the same problem to call the function from the windows 7 pc.
I just recorgized on the video studio that the javascript file /include/navigation.js[dynamic]. Does it mean the js file is created every excusion and my change is not taken?
Sunday, January 18, 2015 3:43 PM -
Adding discovery:
(1) Chrome and FireFox have no issue. Only IE has the problem.
(2) However, IE is fine with the test server.
(3) No problem with IE n Windows 2008.
Still try to find out the issue is due to code, browser or OS.
Many thanks for anyone's help.
Sunday, January 18, 2015 4:32 PM -
Being an only-IE-Problem is very good. Do you have acces to your IE and the Servers one? You should compare the [Security]-Settings of the IEs. And of course, do they have the same version (Version [IE10 | IE11...] and Platform [x64 | x86])?
You also can try to use the F12-Dev-Tools in IE, so yu can go to the Debugger and see whats up.
© 2015 Thomas Roskop
Germany // Deutschland
Sunday, January 18, 2015 4:38 PM -
Adding discovery:
(1) Chrome and FireFox have no issue. Only IE has the problem.
(2) However, IE is fine with the test server.
(3) No problem with IE n Windows 2008.
Still try to find out the issue is due to code, browser or OS.
Many thanks for anyone's help.
I.E. has changed versions and received numerous updates since Windows SERVER 2008.
You don't provide what happens when you use IE from Win 7 PC compared to using Chrome or Firefox from same PC. Or what update state of said PC is. Could be a recent update began causing the issue with IE.
La vida loca
Sunday, January 18, 2015 4:55 PM -
Thanks for both Monkeyboy and Thomas responses. I will do the comparesion in a leter time. For quick respond to your questions.
(1) The code is to generate html calendar display an employee vacation, personal and sick time usage. There is no error when run the application in firefox or chrome. However, got the following error with IE (v11) in a windows 7 pc.
Object reference not set to an instance of an object.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:
Line 484: lit_Person.Text += "<TR><TH>" + onSupervisor2Levels(DateTime.Today.Year.ToString()) + "</TH></TR></TABLE></BR>"; Line 485: Line 486: float vac_balance = (emp_benefits.dVac_Alwnc + emp_benefits.dVac_Carry); Line 487: float pers_balance = (emp_benefits.dPers_Alwnc + emp_benefits.dPers_Carry); Line 488: float sick_balance = (emp_benefits.dSick_Alwnc + emp_benefits.dSick_Carry);
(2) However, I am able to run the same application in the test server without any problem.
(3) There were couple users report the same issue (I believe they all use IE).
All above make me confused that I am not sure if it is a server or pc/browser issue.
Sunday, January 18, 2015 11:55 PM -
Hello,
It's better to open up a new thread in ASP.NET forums here:
This forum is only for questions about C# language, it's not the best place for web development related questions. If you post in ASP.NET forums, more web developers will give you better solutions.
Thanks for your understanding.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Edited by Caillen Monday, January 19, 2015 3:21 AM
Monday, January 19, 2015 3:18 AM -
It is more likely a browser compatibility issue. I added the site to the compatibility view. The problem seems go away.
- Marked as answer by eg10013 Wednesday, January 21, 2015 5:28 PM
Wednesday, January 21, 2015 5:27 PM