.Net Response Object


#1

I have created a aspx, page that allows me to build to draw data from a database & use documentbuilder to create a word doc.

When my aspx page was called simply (without passing variables) my documents would be created perfectly however the moment I passed a variable mypage.aspx?idTable=9, the aspx page would give not download IE would give me a 'cannot connect to server / page doesnt exist' error.

Adding the following code solved the problem.

' Set Download Filename
Response.AddHeader(_
"Content-Disposition","attachment; filename=" +strSe_DocName+";")

' Send the document in Word format to the client browser.
doc.Save( _
strSe_DocName, _
SaveFormat.FormatDocument, _
SaveType.OpenInWord, _
Me.Response)

Response.flush()
Response.end()

Without the response.flush / response.end methods the page wasnot being terminated.

I have read other posts about problems with the response object, maybe this is a topic that a thread should address.


#2

Aspose.Word.Demos works fine with parameters passed to the page. For example see Northwind.aspx.

The only two differences I see that we don’t call Response.AddHeader (because it’s done by doc.Save) and we don’t call Response.Flush, but I don’t think these differences could cause the problem you experience.

There must be something else, probably not related to Aspose.Word here.