I am really stuck here. I am not a champ of ASP.Net and just at internediate developer of ASP.Net, i am creating a Flash based application that needs to insurt data in bulk format, so i decided that instead of sending each entry one by one or as comma seprated
values, i should pack them in one XML format show below:
Then i created a ASP.Net (VB) page that can parse the XML of above format and insert each node's data in the database, while creating the ASP page, i used a following code having my XML hardcoded as shown below (I know the code below can be tunned a lot
for performance and many differnt things but for initial simplicity, i use this rough code:
1 Dim stream As StringReader = New StringReader("<?xml version='1.0' ?><Nodes><node lCode='AP1' lImgs='0' lType='1' lSubType='0' lTitle='Some Title' lCPerson='Some Person' lAdd='Address' lCity='20' lStat='1' lPh='23984298' lSecInfo='sadsad' lMkws='sadsad' /><node lCode='BBS378' lImgs='0' lType='34' lSubType='1' lTitle='Brownstone' lCPerson='Mr Brown' lAdd='stone shop' lCity='20' lStat='1' lPh='873274' lSecInfo='sada' lMkws='dsadsa' /></Nodes>")
2 Dim reader As XmlReader = XmlReader.Create(stream)
3 Dim cmd as MySQLCommand
4 Dim ds as new Dataset()
5 ds.readXml(reader)
6 Dim outStr,sqlStr as String
7 Dim lCode, lTitle, lCperson,lAdd,SecInfo,mkws,lph as String
8 Dim imgC,lType,lSubType,lcity,lstat,cnt as Integer
9 Dim i As DataRow
10 cnt = 0
11 outStr = "<nodes>"
12 myConnection.open()
13 For Each i In ds.Tables(0).Rows
14 'Code to insert recieved data in database
15 Next
16 myConnection.Close()
17 outStr = outStr & "</nodes>"
The above written code works fine, but instead of hardcoding the XML data, if i send the data as an HTTPPost or HTTPGet method, i get the error:
A potentially dangerous Request.Form value was detected from the client (xml="<nodes>
</nodes>").
So i need a method to send data to an ASP.Net page in XML format.
NOTE:I cannto use webservices here or cannot load data from a seperate XML file. Nor can i use name/value pairs
Please help me in this one as i am very short in time and stucked only in this step of passing XML data
Or can you tell me some alternate method os recieving XML data from other sources.
smazherhq
Member
85 Points
18 Posts
Sending XML formatted data as HTTPPost method and security issue
Aug 30, 2006 08:27 AM|LINK
Hello every one!
I am really stuck here. I am not a champ of ASP.Net and just at internediate developer of ASP.Net, i am creating a Flash based application that needs to insurt data in bulk format, so i decided that instead of sending each entry one by one or as comma seprated values, i should pack them in one XML format show below:
<Nodes>
<node lCode="SomeCode" lImgs="0" lType="1" lSubType="-1" lTitle="SomeTitle" lCPerson="SomePerson" lAdd="SomeAddress" lCity="9" lStat="1" lPh="123456" lSecInfo="sadjdsahkdsa,dsa,da,sd" lMkws="sad,sadsa,d,as,d" />
<node lCode="" lImgs="0" lType="1" lSubType="-1" lTitle="" lCPerson="" lAdd="" lCity="9" lStat="1" lPh="" lSecInfo="" lMkws="" /><node lCode="" lImgs="0" lType="1" lSubType="-1" lTitle="" lCPerson="" lAdd="" lCity="9" lStat="1" lPh="" lSecInfo="" lMkws="" />
<node lCode="" lImgs="0" lType="1" lSubType="-1" lTitle="" lCPerson="" lAdd="" lCity="9" lStat="1" lPh="" lSecInfo="" lMkws="" /></Nodes>
Then i created a ASP.Net (VB) page that can parse the XML of above format and insert each node's data in the database, while creating the ASP page, i used a following code having my XML hardcoded as shown below (I know the code below can be tunned a lot for performance and many differnt things but for initial simplicity, i use this rough code:
1 Dim stream As StringReader = New StringReader("<?xml version='1.0' ?><Nodes><node lCode='AP1' lImgs='0' lType='1' lSubType='0' lTitle='Some Title' lCPerson='Some Person' lAdd='Address' lCity='20' lStat='1' lPh='23984298' lSecInfo='sadsad' lMkws='sadsad' /><node lCode='BBS378' lImgs='0' lType='34' lSubType='1' lTitle='Brownstone' lCPerson='Mr Brown' lAdd='stone shop' lCity='20' lStat='1' lPh='873274' lSecInfo='sada' lMkws='dsadsa' /></Nodes>") 2 Dim reader As XmlReader = XmlReader.Create(stream) 3 Dim cmd as MySQLCommand 4 Dim ds as new Dataset() 5 ds.readXml(reader) 6 Dim outStr,sqlStr as String 7 Dim lCode, lTitle, lCperson,lAdd,SecInfo,mkws,lph as String 8 Dim imgC,lType,lSubType,lcity,lstat,cnt as Integer 9 Dim i As DataRow 10 cnt = 0 11 outStr = "<nodes>" 12 myConnection.open() 13 For Each i In ds.Tables(0).Rows 14 'Code to insert recieved data in database 15 Next 16 myConnection.Close() 17 outStr = outStr & "</nodes>"The above written code works fine, but instead of hardcoding the XML data, if i send the data as an HTTPPost or HTTPGet method, i get the error:
A potentially dangerous Request.Form value was detected from the client (xml="<nodes>
</nodes>").
So i need a method to send data to an ASP.Net page in XML format.
NOTE:I cannto use webservices here or cannot load data from a seperate XML file. Nor can i use name/value pairs
Please help me in this one as i am very short in time and stucked only in this step of passing XML data
Or can you tell me some alternate method os recieving XML data from other sources.