">" in a asp classic vbscript string blanks the entire string

Posted on 2013-09-16
Medium Priority
Last Modified: 2013-09-17
I'm modifying an old piece of code I don't want to upgrade ( no time), but it uses classic ASP.

I'm trying to add an LDAP query, but when I do this:

sBase = "<LDAP://" & "sDNSDomain" & " >"

I end up with a blank string.  If I remove the ">" then it's fine.  I've been unable to find out how to escape it.... and the LDAP query won't work without it.

What am I missing here?  The LDAP query examples I run across all give this format for building a query, but it simply won't work for me.
Question by:scmace
LVL 20

Expert Comment

by:Rikin Shah
ID: 39498447

You can remove both brackets... and try again.
LVL 28

Accepted Solution

sybe earned 800 total points
ID: 39498641
Of course it is no blank string. In an HTML document, your browser will not show anything between <.... and ...>, because it supposes it is some kind of html-element.

Escape them with the Server.HTMLEncode() function, or simply:

> = &gt;
< = &lt;

Author Closing Comment

ID: 39499220
I spent so much time chasing what I thought was a badly formed query, this enabled me to find the SECURITY issue that was preventing successful execution.

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question