Hi guys,
This is driving me nuts. I am relatively new to .NET and am using Visual Studio 2003. All I want to do is display a word document in the browser (I have a Crystal Reports application that exports to .doc and I want to display the results). After the Crystal Report is exported, the user is re-directed to a new webform, DOC.aspx, where in page_load I have the following code:
Dim myfile As String
myfile = "c:\inetpub\ & Session.SessionID.ToString & ".doc"
Response.ClearContent()
Response.ClearHeaders()
Response.Buffer = True
Response.ContentType = "application/ms-word"
Response.AddHeader("Content-Disposition", "attachment; filename=" & myfile)
Response.WriteFile(myfile)
Response.Flush()
Response.Close()
System.IO.File.Delete(myfile)
Upon execution, it prompts for Save/Open, if I choose Open, I get my list of applications from which to Open a file called DOC[1]. Why won't it just open my file to word and why is it seeing DOC[1] and not myfile? Any help on this seemingly basic issue would be appreciated.
This is driving me nuts. I am relatively new to .NET and am using Visual Studio 2003. All I want to do is display a word document in the browser (I have a Crystal Reports application that exports to .doc and I want to display the results). After the Crystal Report is exported, the user is re-directed to a new webform, DOC.aspx, where in page_load I have the following code:
Dim myfile As String
myfile = "c:\inetpub\ & Session.SessionID.ToString & ".doc"
Response.ClearContent()
Response.ClearHeaders()
Response.Buffer = True
Response.ContentType = "application/ms-word"
Response.AddHeader("Content-Disposition", "attachment; filename=" & myfile)
Response.WriteFile(myfile)
Response.Flush()
Response.Close()
System.IO.File.Delete(myfile)
Upon execution, it prompts for Save/Open, if I choose Open, I get my list of applications from which to Open a file called DOC[1]. Why won't it just open my file to word and why is it seeing DOC[1] and not myfile? Any help on this seemingly basic issue would be appreciated.