Here is my Xpath:
path="form/document[contains(<%=request.Form("search_by")%>,'<%= request.Form("txtSearch")%>')]//*";
I told you a few hours ago: this is not an XPath [expression], it is an ASP|JSP|PHP construct that generates an XPath expression. (Why do you ask questions on this forum if you are going to ignore the answers?)
Presumably on this occasion the ASP|JSP|PHP construct has generated an invalid XPath expression, which it would do for example if <%=request.Form("search_by")%> evaluated to an empty string.
I also told you that you need to prevent injection attacks when writing this kind of code, more advice that you seem to have ignored completely.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference