Word doc not opening in ie

J

Jeff User

Hi all

C#, .net1.1, plain old aspx page with nothing on it.

The aspx page is named ViewComments.aspx

I read a clob column from an Oracle db.
then I send it to the Response out like this:
//Where the clob data is found in the DataSet ds

sComment = ds.Tables[0].Rows[0]["COMM_TEXT"].ToString();
long fSize = sComment.Length;

if (Convert.ToInt32(sComment.IndexOf(@"\rtf1\ansi\")) > 0)
{
sContentType = "application/msword";

Response.Clear();
Response.ContentType = sContentType;

System.Text.ASCIIEncoding encoding=new
System.Text.ASCIIEncoding();
Response.OutputStream.Write(encoding.GetBytes(sComment), 0,
Convert.ToInt32(fSize));

Response.End;
}


This works perfect on my dev machine. When the form opens, the user is
prompted to open or save the Doc.

When I move it to any other machine, the user is prompted to open or
save ViewComments.aspx (my aspx file name) not the doc.
Type shown on save dialog is "ASP.NET Server Page 83.kb"

Why doesnt this work anywhere other than where I built it?
Thanks
Jeff
 
G

Guest

Jeff User,
Couple ideas:

1) This looks like RTF, not word. Of course it should load in word, but
what's the MIME type for RTF?
2) with this -System.Text.ASCIIEncoding encoding=new
System.Text.ASCIIEncoding();
Response.OutputStream.Write(encoding.GetBytes(sComment), 0,
Convert.ToInt32(fSize));
-- what I'd consider doing is to get the whole thing into a string first and
verify that you've got what you think you have.

3) Is "Response.End" a legitimate C# method call? Shouldn't this be
Response.End()..?

4. Are you sure your ASPX "Page" ONLY has the @Page declaration and nothing
else?
--Peter
 

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