XSN form streaming from db works for FF but not IE

M

Matt

Hi,

I have xsn templates stored in db table and I am streaming xsn form as
binary stream to client's browser.
My page http://localhost/GetFile.aspx?FormId=7 code snipsets looks like this

--------------------------------------------------------------------------
while (sqlDataReader.Read())
{
string fileExtension = sqlDataReader["FileExtension"].ToString();
byte[] formFile = (byte[])sqlDataReader["File"];
int fileSize = Int32.Parse(sqlDataReader["FileSize"].ToString());

HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = false;

HttpContext.Current.Response.ContentType =
(string)sqlDataReader["FileContentType"];
HttpContext.Current.Response.AddHeader("Content-Length",
fileSize.ToString());
HttpContext.Current.Response.AddHeader("Accept-Ranges", "bytes");

HttpContext.Current.Response.AddHeader("Content-Disposition",
"attachment; filename=\"" +
sqlDataReader["FileName"].ToString() + "." +
sqlDataReader["FileExtension"].ToString() + "\"");

HttpContext.Current.Response.BinaryWrite(formFile);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}
------------------------------------------------------


The problem is that it works for FF - FF starts InfoPath 2007 and display
form.
But in IE7, when IE& starts Infopath 2007, then Infopath display strange
message.

**********************************************************
The form contains XML that cannot be parsed:
An invalid character was found in text content.

Line 1, Position 5
MSCF
************************************************

There is nothing on Position 5, just empty space.

Can somebody give me hint where I am making mistake ?
Thank you.

Matt
 
S

Shiva (GGK Tech)

Hello,

The specified position element data is invalid. Can you check once what the
characters try to display in that position is. Whichever you are taking that
xml should be well structured otherwise it will give error message.
 
M

Matt Alic

HI,

Hexa value of that charracter is 00

Martin

Shiva (GGK Tech) said:
Hello,

The specified position element data is invalid. Can you check once what the
characters try to display in that position is. Whichever you are taking that
xml should be well structured otherwise it will give error message.

--
Shiva
http://www.ggktech.com


Matt said:
Hi,

I have xsn templates stored in db table and I am streaming xsn form as
binary stream to client's browser.
My page http://localhost/GetFile.aspx?FormId=7 code snipsets looks like this

--------------------------------------------------------------------------
while (sqlDataReader.Read())
{
string fileExtension = sqlDataReader["FileExtension"].ToString();
byte[] formFile = (byte[])sqlDataReader["File"];
int fileSize = Int32.Parse(sqlDataReader["FileSize"].ToString());

HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = false;

HttpContext.Current.Response.ContentType =
(string)sqlDataReader["FileContentType"];
HttpContext.Current.Response.AddHeader("Content-Length",
fileSize.ToString());
HttpContext.Current.Response.AddHeader("Accept-Ranges", "bytes");

HttpContext.Current.Response.AddHeader("Content-Disposition",
"attachment; filename=\"" +
sqlDataReader["FileName"].ToString() + "." +
sqlDataReader["FileExtension"].ToString() + "\"");

HttpContext.Current.Response.BinaryWrite(formFile);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}
------------------------------------------------------


The problem is that it works for FF - FF starts InfoPath 2007 and display
form.
But in IE7, when IE& starts Infopath 2007, then Infopath display strange
message.

**********************************************************
The form contains XML that cannot be parsed:
An invalid character was found in text content.

Line 1, Position 5
MSCF
************************************************

There is nothing on Position 5, just empty space.

Can somebody give me hint where I am making mistake ?
Thank you.

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top