This is common JavaScript error occurred while working with asp.net. I have faced this problem numerous times and believe me this is really very cumbersome error. This error occurs because of badly written JavaScript or due to access permission to the particular file, folder or image(s). Sometimes in your code if you have written path which does not exist in your .net web application. This kind error may occur. Friends, I have got this error many times and trust me each and every time its tuff to find where the problem is. Even my colleagues got this kind error many times. I have searched a lot about this error on Internet but not able to find the exact solution. Everybody is saying that it’s because of unclosed quotation mark in JavaScript. It’s true but not in every case.
In addition, what happens sometime you may not get this error while you work locally and the time when you deploy it to web-server you will get ‘unterminated string constant’ error. Am I correct ?
Here are the checklists/suggestions to resolve this error.
- Check you javascript for unclosed quotation mark. Check inline as well as reference JavaScript file. Starts with inline JavaScript.
- Give proper permission (rights) to directory under which your aspx page laying. Ex. Rights for IIS user, ASP.net process.
- Also check permission (rights) for image directory, if you are working with images.
- Check for the hard coded path in the CS(Class file in C#) ,if any, check existence for the path.
I hope the solutions above might be useful to resolve unterminated string constants error.