The XML file cannot be displayed error

E

ericvdb

Hi all,

I'm trying to fill a PDF form with asp.net using the FDF Toolkit.
I have a simple form with a textbox and a button. When the button is
clicked, the pdf should open with the field filled from the textbox.

When I open the page in IE (whatever version) i get :
############################################################
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then
click the Refresh button, or try again later.

----------------------------------------------------------------------------
----

An invalid character was found in text content. Error processing resource
'http://sher-mail-temp/e-swita/trythis.aspx'. Li...
############################################################

Here is the trythis.aspx code

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="trythis.aspx.vb"
Inherits="e_swita.trythis"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>trythis</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<P>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
<P>&nbsp;</P>
</form>
</body>
</HTML>



and the codebehind trythis.aspx.vb :

Public Class trythis
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
'Put user code to initialize the page here
Dim FdfAcX As FDFACXLib.FdfApp
FdfAcX = New FDFACXLib.FdfApp
Dim outputFDF = FdfAcX.FDFCreate()
outputFDF.FDFSetFile("http://sher-mail-temp/e-swita/test2.pdf")

outputFDF.FDFSetValue("testfield", "test", False)

HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.ContentType = "application/vnd.fdf"
HttpContext.Current.Response.BinaryWrite(outputFDF.FDFSaveToBuf)

outputFDF.FDFClose()

End Sub
End Class


Now what I tried is delete all the HTML except the <%@ Page Language="vb"
.....%> in trythis.aspx and guess what, there's the pdf file.
This proves that my MIME settings are ok, right?

So, is this a bug in the .Net framework ?

Anybody has an idea how this can be solved ?

Many thanks in advance,
Eric
 
M

Martin Dechev

Hi, Eric,

Just call Response.End() at the end of the Button1_Click method. See inline

Greetings
Martin
 

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

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top