Edit: this does not answer your first problem, but still applies after you fix it. If vDirectory was something like "c: \ new folder", you would get a new line in t.
I'm not sure which language you are using, but you want to run the line though addslashes () (or the equivalent in your language) before printing it like this:
var t='<%=addslashes(ConfigurationManager.AppSettings("vDirectory").ToString()) %>';
Or even better, JSON encodes it if there is a function for this:
var t=<%=json_encode(ConfigurationManager.AppSettings("vDirectory").ToString()) %>;
source
share