Link to home
Start Free TrialLog in
Avatar of lothos123452000
lothos123452000Flag for United States of America

asked on

htmldecode

On my windows app I have the following code: On my asp.net webpage I have the code following the windows app. I am using request.form(2) because for some reason that is where the xml gets posted. Try as I may I cannot get the HtmlDecode utility on my website to decode the xml information I am feeding it. The xml does get there htmlencoded I just can't unencode it. Any help offered is greatly appreciated. Again I have no idea what I am doing wrong.
'Windows app code            
Dim sentStr As String = "SureScriptXML=" + System.Web.HttpUtility.HtmlEncode(xmlData)
            If xmlData.Trim.Length > 0 Then
                Dim web As New System.Net.WebClient()
                web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
                Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes(sentStr)
                Dim res As Byte() = web.UploadData("http://emis09/Website/Posting/Default.aspx", "POST", d)
            Else
                Throw New Exception("There was no xml data.")
            End If
            Return True
 
'Asp.net code
If Request.Form.Count > 0 Then
            Dim x As String = Request.Form("SureScriptXML")
            Dim y As New System.IO.StringWriter
 
            x = Request.Form(2)
            'x = HttpUtility.UrlDecode(x)
            'HttpUtility.HtmlDecode(x, y)
            Server.HtmlDecode(x, y)
            If x Is Nothing Then Exit Sub
            Dim xml As New XmlDocument
            xml.LoadXml(y.ToString)
 
            xml.Save("c:\XmlTesting.xml")

Open in new window

Avatar of abel
abel
Flag of Netherlands image

I don't know what the windows does further, but if you use the output of that function to paste it on a form to send it to your server with the asp.net code, then you will have to do two HtmlDecodes on a row, because the already encoded string is re-encoded by the internet browser.

If not, can you place a breakpoint and show what the encoded xml looks like when it is received by the asp.net code (use the Immediate window)? Make sure to paste it in the code snippet, because the normal comment window makes mistakes with escape sequences.
Avatar of lothos123452000

ASKER

Yeah I tried to do 2 html decodes in a row but it did nothing to decode the xml. I even tried 3 not sure what else I can try. The xml is making it to the website I just cannot decode it. And if I try not to encode it on the client I will get a 500 error message telling me there is something up with the server. Please help.
I tried to replicate your behavior, but it works like a charm here.

I really need a look at your data how it is received in the asp.net. Please follow-up on my earlier request and place a breakpoint there, use the immediate window to catch the output (or Debug.Write).

What version of .NET are you using?
I am using 2005, but I figured out a little more. Basically when I htmlencode my xml it adds the following text in 2 location '&=' which when posting means I am posting mutiple values when infact I am only posting 1 value. So the data I am sending in originally looks like the following:

test=<xml data>

after the encode it looks like

test &=<xml data>

and the encode actually puts another &= in the xml thus sending 3 items. When it get to the website I can't decode it because it mangled. Do you have any suggestions on how to combat this on how to handle the &=. And again thanks for the help.
remember what I said earlier:

> Make sure to paste it in the code snippet, because the normal comment window makes mistakes with escape sequences.
which is why it probably doesn't show the way you want it to show. Can you try again (though even the code snippet edit box sometimes has problems)
Sorry, maybe I misunderstand your whole question: I thought you wanted to encode the xml data. Now it looks as if "=" becomes "&=". Which is strange, because that has nothing to do with html encoding.... If you do htmlencoding, I am expecting something like this, after encoding:

// show what it should look like for <root>test</root>
 
&lt;root&gt;test&lt;/root&gt;

Open in new window

Your right it also looks like that but it is adding the &= to that information has well. I am doing html encodeing if you look at my first post which display the code on how I am doing the html encodeing and posting. 'xmldata' being the string that contains the xml. Any thoughts or suggestions.
Actually let me correct myself it is encoding in the following way

test=<Message......

when originally it looks like
test=<message etc........

Sorry the site changed by above message in the following text

test=<Message......

= was replaced by '&lt'
>                Was this comment helpful?                         Yes               No                                 lothos123452000:             Sorry the site changed by above message in the following text
like I suggested a couple of times: please use the "code snippet" for this, it will save us both a lot of time...

and can you check my follow-up comment? Is that what you see? If I use the following snippet in code, I get the original XML back in the last statement, can you test if that works for you too?

string xmlString = "<root>test</root>";
string t = System.Web.HttpUtility.HtmlEncode(xmlString);
string decoded = System.Web.HttpUtility.HtmlDecode(t);

Open in new window

> 'xmldata' being the string that contains the xml. Any thoughts or suggestions.

can you show the xmldata the way it looked before and after the encoding, and before it was received in the asp.net application?
To help you out with giving me the information to need to help you with this problem, please replace the ASP.NET code with this and paste the output in the debug window in the code snippet window in EE.



Dim sureScriptEscaped As String = Request.Form("SureScriptXML")
Dim stringWriterUnEscape As New System.IO.StringWriter
 
sureScriptEscaped = Request.Form(2)
Debug.WriteLine("BEFORE ESCAPE:" & vbCrLf & sureScriptEscaped)
Server.HtmlDecode(sureScriptEscaped, stringWriterUnEscape)
If sureScriptEscaped Is Nothing Then Exit Sub
Dim xml As New XmlDocument
Dim escapedHtml = stringWriterUnEscape.ToString()
Debug.WriteLine("AFTER ESCAPE:" & vbCrLf & escapedHtml)
xml.LoadXml(escapedHtml)

Open in new window

You are correct that does work and decoding the string in the application works as well. However it does not work when I post the emcoded string to the website and try to decode the html string in the website any ideas why. Also if you are trying to test your self you should use the test string I am posting in the code snippet it more like the xml I am trying to post. Thanks for the help.
Dim teststr as string = "test=<root message="http://www.test.com"><Header><To>test</To></Header></root>"
 
'The following is the code I have on the website for decoding.
        Dim x As String = Request.Form("test")
        Dim y As New System.IO.StringWriter
 
        If Not x Is Nothing Then
 
            HttpUtility.HtmlDecode(x, y)
            HttpUtility.HtmlDecode(x, y)
 
            If x Is Nothing Then Exit Sub
            Dim xml As New XmlDocument
            xml.LoadXml(y.ToString)
 
            xml.Save("c:\XmlTesting.xml")
        End If
 
'And the following code is on the client used for posting.
 Dim sentStr As String = "test=" + System.Web.HttpUtility.HtmlEncode(xmlData)
            If xmlData.Trim.Length > 0 Then
                sentStr = System.Web.HttpUtility.HtmlDecode(sentStr)
 
                Dim web As New System.Net.WebClient()
                web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
                Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes(sentStr)
                Dim res As Byte() = web.UploadData("http://testHost/Website/Posting/Default.aspx", "POST", d)

Open in new window

Below is the information you requested
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
Auto-attach to process '[3464] aspnet_wp.exe' on machine 'EMIS09' succeeded.
Warning: Cannot debug script code. Script debugging is disabled for the application you are debugging. Please uncheck the 'Disable script debugging' option on the Internet Options dialog box (Advanced page) for Internet Explorer and restart the process.
BEFORE ESCAPE:
quot;http://www.surescripts.com/messaging,quot;,gt;,lt;Header,gt;,lt;To,gt;jgonzales@texasmedclinic.com,lt;/To,gt;,lt;From,gt;jgonzales@texasmedclinic.com,lt;/From,gt;,lt;MessageId,gt;770d5283-70df-46f8-8d2e-91d14234422e,lt;/MessageId,gt;,lt;SentTime,gt;4/21/2009 3:03:29 PM,lt;/SentTime,gt;,lt;AppVersion,gt;,lt;VendorName,gt;Texas MedClinic,lt;/VendorName,gt;,lt;AppName,gt;Prescription Writer,lt;/AppName,gt;,lt;ApplicationVersion,gt;1.0.3398.16637,lt;/ApplicationVersion,gt;,lt;/AppVersion,gt;,lt;/Header,gt;,lt;Body,gt;,lt;NewRx,gt;,lt;PrescriberOrderNumber,gt;b545a5c62fe04d43898dfe4a63922f45,lt;/PrescriberOrderNumber,gt;,lt;Pharmacy,gt;,lt;Identification,gt;,lt;NCPDPID,gt;,lt;/NCPDPID,gt;,lt;/Identification,gt;,lt;StoreName,gt;Susan Test Pharmacy,lt;/StoreName,gt;,lt;Address,gt;,lt;AddressLine1,gt;13722 Embassy Row,lt;/AddressLine1,gt;,lt;City,gt;San Antonio,lt;/City,gt;,lt;State,gt;TX,lt;/State,gt;,lt;ZipCode,gt;78216,lt;/ZipCode,gt;,lt;/Address,gt;,lt;PhoneNumbers,gt;,lt;Phone,gt;,lt;Number,gt;3495577,lt;/Nu
mber,gt;,lt;Qualifier,gt;TE,lt;/Qualifier,gt;,lt;/Phone,gt;,lt;Phone,gt;,lt;Number,gt;4912870,lt;/Number,gt;,lt;Qualifier,gt;FX,lt;/Qualifier,gt;,lt;/Phone,gt;,lt;/PhoneNumbers,gt;,lt;/Pharmacy,gt;,lt;Prescriber,gt;,lt;Identification,gt;,lt;SPI,gt;,lt;/SPI,gt;,lt;DEANumber,gt;FN1088548,lt;/DEANumber,gt;,lt;/Identification,gt;,lt;ClinicName,gt;Test,lt;/ClinicName,gt;,lt;Name,gt;,lt;LastName,gt;Nobles,lt;/LastName,gt;,lt;FirstName,gt;Patrick,lt;/FirstName,gt;,lt;MiddleName,gt;A,lt;/MiddleName,gt;,lt;Suffix,gt;MD,lt;/Suffix,gt;,lt;Prefix,gt;,lt;/Prefix,gt;,lt;/Name,gt;,lt;Address,gt;,lt;AddressLine1,gt;13722 Embassy Row,lt;/AddressLine1,gt;,lt;City,gt;San Antonio,lt;/City,gt;,lt;State,gt;TX ,lt;/State,gt;,lt;ZipCode,gt;78216,lt;/ZipCode,gt;,lt;/Address,gt;,lt;PhoneNumbers,gt;,lt;Number,gt;2103495577,lt;/Number,gt;,lt;Qualifier,gt;TE,lt;/Qualifier,gt;,lt;/PhoneNumbers,gt;,lt;/Prescriber,gt;,lt;Patient,gt;,lt;Identification,gt;,lt;SocialSecurity,gt;,lt;/SocialSecurity,gt;,lt;/Identification,gt;,lt;Name,gt;,lt;LastN
ame,gt;RxTesting,lt;/LastName,gt;,lt;FirstName,gt; Shelly,lt;/FirstName,gt;,lt;/Name,gt;,lt;Gender,gt;,lt;/Gender,gt;,lt;DateOfBirth,gt;,lt;/DateOfBirth,gt;,lt;Address,gt;,lt;AddressLine1,gt;123 Drive St,lt;/AddressLine1,gt;,lt;City,gt;San Antonio,lt;/City,gt;,lt;State,gt;TX ,lt;/State,gt;,lt;/Address,gt;,lt;Email,gt;,lt;/Email,gt;,lt;PhoneNumbers,gt;,lt;Phone,gt;,lt;Number,gt;               ,lt;/Number,gt;,lt;Qualifier,gt;,lt;/Qualifier,gt;,lt;/Phone,gt;,lt;/PhoneNumbers,gt;,lt;/Patient,gt;,lt;MedicationPrescribed,gt;,lt;DrugDescription,gt;Habitrol 21mg Transdermal Patch,lt;/DrugDescription,gt;,lt;Quantity,gt;,lt;Qualifier,gt;ZZ,lt;/Qualifier,gt;,lt;value,gt;4,lt;/value,gt;,lt;/Quantity,gt;,lt;Directions,gt;1 daily,lt;/Directions,gt;,lt;Note,gt;,lt;/Note,gt;,lt;Refills,gt;,lt;Qualifier,gt;PRN,lt;/Qualifier,gt;,lt;/Refills,gt;,lt;Substitutions,gt;0,lt;/Substitutions,gt;,lt;WrittenDate,gt;4/21/2009,lt;/WrittenDate,gt;,lt;/MedicationPrescribed,gt;,lt;/NewRx,gt;,lt;/Body,gt;,lt;/Message,gt;
AFTER ESCAPE:
quot;http://www.surescripts.com/messaging,quot;,gt;,lt;Header,gt;,lt;To,gt;jgonzales@texasmedclinic.com,lt;/To,gt;,lt;From,gt;jgonzales@texasmedclinic.com,lt;/From,gt;,lt;MessageId,gt;770d5283-70df-46f8-8d2e-91d14234422e,lt;/MessageId,gt;,lt;SentTime,gt;4/21/2009 3:03:29 PM,lt;/SentTime,gt;,lt;AppVersion,gt;,lt;VendorName,gt;Texas MedClinic,lt;/VendorName,gt;,lt;AppName,gt;Prescription Writer,lt;/AppName,gt;,lt;ApplicationVersion,gt;1.0.3398.16637,lt;/ApplicationVersion,gt;,lt;/AppVersion,gt;,lt;/Header,gt;,lt;Body,gt;,lt;NewRx,gt;,lt;PrescriberOrderNumber,gt;b545a5c62fe04d43898dfe4a63922f45,lt;/PrescriberOrderNumber,gt;,lt;Pharmacy,gt;,lt;Identification,gt;,lt;NCPDPID,gt;,lt;/NCPDPID,gt;,lt;/Identification,gt;,lt;StoreName,gt;Susan Test Pharmacy,lt;/StoreName,gt;,lt;Address,gt;,lt;AddressLine1,gt;13722 Embassy Row,lt;/AddressLine1,gt;,lt;City,gt;San Antonio,lt;/City,gt;,lt;State,gt;TX,lt;/State,gt;,lt;ZipCode,gt;78216,lt;/ZipCode,gt;,lt;/Address,gt;,lt;PhoneNumbers,gt;,lt;Phone,gt;,lt;Number,gt;3495577,lt;/Nu
mber,gt;,lt;Qualifier,gt;TE,lt;/Qualifier,gt;,lt;/Phone,gt;,lt;Phone,gt;,lt;Number,gt;4912870,lt;/Number,gt;,lt;Qualifier,gt;FX,lt;/Qualifier,gt;,lt;/Phone,gt;,lt;/PhoneNumbers,gt;,lt;/Pharmacy,gt;,lt;Prescriber,gt;,lt;Identification,gt;,lt;SPI,gt;,lt;/SPI,gt;,lt;DEANumber,gt;FN1088548,lt;/DEANumber,gt;,lt;/Identification,gt;,lt;ClinicName,gt;Test,lt;/ClinicName,gt;,lt;Name,gt;,lt;LastName,gt;Nobles,lt;/LastName,gt;,lt;FirstName,gt;Patrick,lt;/FirstName,gt;,lt;MiddleName,gt;A,lt;/MiddleName,gt;,lt;Suffix,gt;MD,lt;/Suffix,gt;,lt;Prefix,gt;,lt;/Prefix,gt;,lt;/Name,gt;,lt;Address,gt;,lt;AddressLine1,gt;13722 Embassy Row,lt;/AddressLine1,gt;,lt;City,gt;San Antonio,lt;/City,gt;,lt;State,gt;TX ,lt;/State,gt;,lt;ZipCode,gt;78216,lt;/ZipCode,gt;,lt;/Address,gt;,lt;PhoneNumbers,gt;,lt;Number,gt;2103495577,lt;/Number,gt;,lt;Qualifier,gt;TE,lt;/Qualifier,gt;,lt;/PhoneNumbers,gt;,lt;/Prescriber,gt;,lt;Patient,gt;,lt;Identification,gt;,lt;SocialSecurity,gt;,lt;/SocialSecurity,gt;,lt;/Identification,gt;,lt;Name,gt;,lt;LastN
ame,gt;RxTesting,lt;/LastName,gt;,lt;FirstName,gt; Shelly,lt;/FirstName,gt;,lt;/Name,gt;,lt;Gender,gt;,lt;/Gender,gt;,lt;DateOfBirth,gt;,lt;/DateOfBirth,gt;,lt;Address,gt;,lt;AddressLine1,gt;123 Drive St,lt;/AddressLine1,gt;,lt;City,gt;San Antonio,lt;/City,gt;,lt;State,gt;TX ,lt;/State,gt;,lt;/Address,gt;,lt;Email,gt;,lt;/Email,gt;,lt;PhoneNumbers,gt;,lt;Phone,gt;,lt;Number,gt;               ,lt;/Number,gt;,lt;Qualifier,gt;,lt;/Qualifier,gt;,lt;/Phone,gt;,lt;/PhoneNumbers,gt;,lt;/Patient,gt;,lt;MedicationPrescribed,gt;,lt;DrugDescription,gt;Habitrol 21mg Transdermal Patch,lt;/DrugDescription,gt;,lt;Quantity,gt;,lt;Qualifier,gt;ZZ,lt;/Qualifier,gt;,lt;value,gt;4,lt;/value,gt;,lt;/Quantity,gt;,lt;Directions,gt;1 daily,lt;/Directions,gt;,lt;Note,gt;,lt;/Note,gt;,lt;Refills,gt;,lt;Qualifier,gt;PRN,lt;/Qualifier,gt;,lt;/Refills,gt;,lt;Substitutions,gt;0,lt;/Substitutions,gt;,lt;WrittenDate,gt;4/21/2009,lt;/WrittenDate,gt;,lt;/MedicationPrescribed,gt;,lt;/NewRx,gt;,lt;/Body,gt;,lt;/Message,gt;
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of abel
abel
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey I figured it out all I had to do was set validaterequest="false" on my website and I did not even have to encode the xml, so it ended up working fine. Thank you for the help.
very interesting point you are making there. I knew that validaterequest might tamper with parameters that are html style, but never realised it would mean that plain XML would also be tampered with.

Interesting to investigate that some day. It should be possible to have both validate on and handle the request....