Hi
Firstly I am using FreeTextBox to edit a document in the browser. I wish to provide the function to user where they can choose to either save to the server or download to the desktop... I am having a small problem with my code... The file opens ok but the document includes not only the content from my textbox but also the whole pages html.
the code --
17 'Try to write the file to the stream for user download.
18 Try
19 If DropDownSaveTo.SelectedValue = ("Desktop") Then
20 '' Open the stream and read it back.
21 fsdoc = File.Open(doc, FileMode.Open, FileAccess.Read)
22 Response.AddHeader("Content-Disposition", "attachment; filename=" & docname.Text & DropDownList1.Text)
23 Response.ContentType = "text/octet-stream"
24 Dim b(1024) As Byte
25 Dim temp As UTF8Encoding = New UTF8Encoding(True)
26 Dim sw As New StreamWriter(Response.OutputStream)
27
28 Do While fsdoc.Read(b, 0, b.Length) > 0
29 sw.Write(temp.GetString(b))
30 sw.Close()
31 Loop
32 fsdoc.Close()
33 End If
34 Catch ex As Exception
35 Response.Write(ex)
36 End If
This has the effect of writing the document from the contents of freetextbox and then downloading the document.... problem is the document looks something like
FTBv3-1-6/editor.aspx?info.text=Done'>Welcome to Document Editor
User Interface version 1.0. To get started simply use the buttons
to edit, save or print documents in this window.
<input type="hidden" name="__WPPS" id="__WPPS" value="u" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
When it should look like Welcome to Document Editor User Interface version 1.0.
To get started simply use the buttons to edit, save or print
documents in this window.
Anyone any ideas ?
regards
mal
Confused, Delighted, Sad, Elated ? is that not a programmers job description!!