Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / July 2007

Tip: Looking for answers? Try searching our database.

Word doc not opening in ie

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff User - 17 Jul 2007 23:25 GMT
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
Peter Bromberg [C# MVP] - 18 Jul 2007 02:58 GMT
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
Signature

Recursion: see Recursion
site:  http://www.eggheadcafe.com
unBlog:  http://petesbloggerama.blogspot.com
bogMetaFinder:    http://www.blogmetafinder.com

> Hi all
>
[quoted text clipped - 34 lines]
> Thanks
> Jeff

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.