B
Biff
I have a WordML file that I want to render in the browser in word via
ASP.NET. If I use Response.Redirect("filename.xml") in the ASP.NET
codebehind I can get it to work. I would prefer to use set the
ContentType to the appropriate value and write the actual XML text to
the Response object, but I can't get that to work. I've tried the
following-
//***************************************************************
// This shows the contents as XML
//***************************************************************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}
Response.ContentType = "text/xml";
Response.Write(fileContents);
//***************************************************************
// This puts a a Word dialog that says "the XML file Default.aspx
cannot be opened
// because there are problems with the contents
//***************************************************************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}
//Response.Clear();
Response.ContentType = "application/msword";
Response.Write(fileContents);
//***************************************************************
// This shows the contents as XML
//***************************************************************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}
//Response.Clear();
Response.ContentType = "application/msword-xml";
Response.Write(fileContents);
My final goal is to allow the document to be edited with Word, then
intercept the save event in the ASP.NET code to grab the document and
process within ASP.NET rather than granting the client user rights to
save a file to the server.
Any ideas or suggestions?
Biff Gaut
Gaithersburg, MD
ASP.NET. If I use Response.Redirect("filename.xml") in the ASP.NET
codebehind I can get it to work. I would prefer to use set the
ContentType to the appropriate value and write the actual XML text to
the Response object, but I can't get that to work. I've tried the
following-
//***************************************************************
// This shows the contents as XML
//***************************************************************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}
Response.ContentType = "text/xml";
Response.Write(fileContents);
//***************************************************************
// This puts a a Word dialog that says "the XML file Default.aspx
cannot be opened
// because there are problems with the contents
//***************************************************************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}
//Response.Clear();
Response.ContentType = "application/msword";
Response.Write(fileContents);
//***************************************************************
// This shows the contents as XML
//***************************************************************
string fileContents;
using (System.IO.StreamReader sr = new
System.IO.StreamReader(@"c:\temp\quizxml.xml"))
{
fileContents = sr.ReadToEnd();
}
//Response.Clear();
Response.ContentType = "application/msword-xml";
Response.Write(fileContents);
My final goal is to allow the document to be edited with Word, then
intercept the save event in the ASP.NET code to grab the document and
process within ASP.NET rather than granting the client user rights to
save a file to the server.
Any ideas or suggestions?
Biff Gaut
Gaithersburg, MD