I post the data from an Infopath form.
In the ASP.Net page i use the following code.
str = Request.InputStream;
strLen = int.Parse(str.Length.ToString());
byte[] strArr = new byte[strLen];
strRead = str.Read(strArr,0,strLen);
Response.Write(System.Text.Encoding.ASCII.GetStrin g(strArr, 0, strLen));
// this print Karthik aaa bbb cccc
I want data in this format, data taken from saved request object for which i
used
System.Web.HttpContext.Current.Request.SaveAs("c:\ \request.txt",false);
<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution
solutionVersion="1.0.0.7" productVersion="11.0.6565" PIVersion="1.0.0.0"
href="file:///C:\Documents%20and%20Settings\J910472\My%20Documen ts\financedeclaration.xsn"
name="urn:schemas-microsoft-com:office:infopath:financedeclaration:-myXSD-2005-05-20T03-34-42"
?><?mso-application progid="InfoPath.Document"?><my:myFields
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-05-20T03:34:42"
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us">
<my:txtEmployeeName>Karthik</my:txtEmployeeName>
<my:txtEmployeeCode>0000</my:txtEmployeeCode>
<my:txtPANNumber>Applied</my:txtPANNumber>
<my:Gender>Male</my:Gender>
<my:txtResidentialAddress>skjfdkfjdkf dfjkfjdf</my:txtResidentialAddress>
<my:blnRentedHouse>false</my:blnRentedHouse>
<my:txtHouseLocated>dddd</my:txtHouseLocated>
<my:txtRentPerMonth>0.0</my:txtRentPerMonth>
<my:txtMonthsinRentedHouse>0</my:txtMonthsinRentedHouse>
<my:txt80D>0.0</my:txt80D>
<my:txt80DD>0.0</my:txt80DD>
<my:txt80DDB>0.0</my:txt80DDB>
<my:txt80E>0.0</my:txt80E>
<my:txt80G>0.0</my:txt80G>
<my:txt80GG>0.0</my:txt80GG>
<my:txtOther>0.0</my:txtOther>
<my:txtPensionFund>0.0</my:txtPensionFund>
<my:txtNSC>0.0</my:txtNSC>
<my:txtPPF>0.0</my:txtPPF>
<my:txtIB>0.0</my:txtIB>
<my:txtCE>0.0</my:txtCE>
<my:txtHLP>0.0</my:txtHLP>
<my:txtInsurance>0.0</my:txtInsurance>
<my:txtOtherDeduction>0.0</my:txtOtherDeduction>
<my:blnHouseOccupied>true</my:blnHouseOccupied>
<my:blnLoanB41999>true</my:blnLoanB41999>
<my:txtRentfromHouse>0.0</my:txtRentfromHouse>
<my:txtLoanInterest>0.0</my:txtLoanInterest>
<my:Note></my:Note>
</my:myFields>
Thanks,
Karthik
"Karthik" wrote:
I am trying to read Http request body values NOT form values
The content type is text/xml and its POST
I am posting data from Infopath to an asp.net page.
In ASP it works by just writing Response.Write(request) the same does not
work in ASP.NET
I tried using Rquest.BinaryrRead() and Request.InputStream but it gives me
text values as space separated (eg Karthik yyyy aaaa) whereas the data i am
looking out for is in XML format.
When I tried saving the Request object to a file using
Request.SaveAs("c:\\request.txt, false), it file contained xml text in the
format which I required.
In ASP too I get this xml string easily by get getting the request object.
Help me with a solution.
Thanks,
Karthik