after .doc (word) creation it downloads the file but i want it to be opened

R

Richard

On my dev PC the website that i wrote auto creates a word document and it
auto-opens in my webbrowser.
Whenever i visit the site with another PC the website ask if the user wants
to download the .doc document of open it.

Why is this and how can i make sure it opens in the browser only.

my code:
---------------------------------------------
Sub butMaakWord_OnClick(Sender as Object, e as EventArgs)
Dim myConnection As OleDBConnection = New
OleDBConnection(AppSettings("DigifanDatabaseCon"))
myConnection.Open()

Dim ds As DataSet
Dim sXSL As String

ds = New DataSet("klantenkaart")
Dim ContactsDA As OleDBDataAdapter = New OleDBDataAdapter("SELECT *
FROM Klantenbestand WHERE klantnummer="& Request.QueryString("ID") & "",
myConnection)
ContactsDA.Fill(ds, "Klantenbestand")
' XSLT to use for transforming this dataset.
sXSL = "klantenkaart.xslt"

' Close the connection to the data source.
myConnection.Close()
' Transform the dataset by using the appropriate stylesheet.
Dim xmlDoc As XmlDataDocument = New XmlDataDocument(ds)
Dim xslTran As XslTransform = New XslTransform
xslTran.Load(Server.MapPath(sXSL))

' Stream the results of the transformation to Word.
Response.ContentType = "application/msword"
Response.Charset = ""
Response.ContentEncoding = System.Text.Encoding.Default
xslTran.Transform(xmlDoc, Nothing, Response.Output)

End Sub
 
K

Kevin Yu [MSFT]

Hi Richard,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to open word document
automatically in client IE browser. If there is any misunderstanding,
please feel free to let me know.

As far I know, this has something to do with the setting on client machine.
To achieve this, please follow the steps below:

1. Open My Computer window.
2. Select Tools/Folder Options from the menu.
3. Navigate to File Types tab.
4. Select Extension DOC if you are opening a .doc file and click Advanced
button.
5. Check Confirm open after download and Browse in same window checkboxes.
6. Click OK.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
R

Richard

thx a lot, exactly what i needed, sry if it was not really an .NET question
but thx a lot for your help :D

Richard
 

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