Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 290893 - Last Review: October 16, 2002 - Revision: 1.4
FIX: XMLHTTP.Open Method Fails When the Password Contains a Number Sign (#)
This article was previously published under Q290893
When you try to open a connection by using a
XMLHTTP object with a username and password, and the password contains a number sign (#), a run-time error occurs on the
Send method and you receive the following error message:
Error number:800401e4
Error Description: Invalid Syntax
NOTE: This does not occur with MSXML versions 1.0, 2.0, or 2.5.
The XML processes (instead of escapes) the number sign (#).
To work around this problem, use earlier versions of the
XMLHTTP object to make the requests.
This problem was corrected in MSXML 4.0.
Steps to Reproduce Behavior
- Make sure that you have a user account with a password set up on a computer that is running Microsoft Windows NT or Microsoft Windows 2000.
- Paste the following code into Notepad and save it as Clienthttp.asp.
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function XMLHTTPButton_onclick() {
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
xmlhttp.Open("GET","http://localhost/Receiver.asp",false, "TestUser", "Test#User");
xmlhttp.Send();
alert(xmlhttp.responseXML.xml);
}
//-->
</SCRIPT>
<INPUT type="button" value="Submit XMLHTTP" id=XMLHTTPButton name=XMLHTTPButton LANGUAGE=javascript onclick="return XMLHTTPButton_onclick()">
- In the above code, change TestUser and Test#User to reflect your user account's user name and password, respectively.
- Paste the following code into Notepad and save it as Receiver.asp.
<%@language=vbscript%>
<%
Response.ContentType = "text/xml"
response.write "<ReturnValue>1</ReturnValue>"
%>
- In the Internet Information Services Manager, right-click Receiver.asp and click Properties. Click File Security and edit the anonymous user authenication so that only Basic Authentication is selected. Click OK to save the changes.
- Make sure that the page is set for Basic authentication and that the user account that you have chosen can browse to Receiver.asp.
- Run Clienthttp.asp.
- Click the button that you created.
For more information about MSXML, see the following Microsoft Developer Network (MSDN) Web site:
APPLIES TO
- Microsoft XML Parser 2.6
- Microsoft XML Parser 3.0
- Microsoft XML Parser 3.0 Service Pack 1
| kbbug kbfix kbmsxml400fix KB290893 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate