Hi!
I have a problem driving me *%/#&"% crazy. Using VS.NET 2003 (CR integrated), Win 2000 Server, IIS, I'm just developing a simple web app testing the possibility to export web forms to pdf - through CR.
WebForm1 gathers simple data from user, the user makes, through a click, a submit to reportView.aspx where, in page_load sub, the following code lies:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xmlStr As String
xmlStr = "<persons xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='C:\inetpub\wwwroot\pdfWebCreator\personXSD.xsd'>"
xmlStr += "<person>"
xmlStr += "<firstname>"
xmlStr += Session.Item("firstName")
xmlStr += "</firstName>"
xmlStr += "<secondname>"
xmlStr += Session.Item("secondname")
xmlStr += "</secondname>"
xmlStr += "<phonenr>"
xmlStr += Session.Item("phonenr")
xmlStr += "</phonenr>"
xmlStr += "<personid>"
xmlStr += Session.Item("personid")
xmlStr += "</personid>"
xmlStr += "</person>"
xmlStr += "</persons>"
If Session.Item("xmlStr") Is Nothing Then
Session.Add("xmlStr", xmlStr)
Else
Session.Item("xmlStr") = xmlStr
End If
If IO.File.Exists("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml") = False Then
Dim sw As IO.StreamWriter = IO.File.CreateText("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml")
sw.WriteLine(xmlStr)
sw.Flush()
sw.Close()
sw = Nothing
Else
IO.File.Delete("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml")
Dim sw As IO.StreamWriter = IO.File.CreateText("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml")
sw.WriteLine(xmlStr)
sw.Flush()
sw.Close()
End If
Dim Fname As String = "c:\inetpub\wwwroot\pdfwebcreator\test.pdf"
' dsPerson is a dataset created at design time
dsPerson.ReadXmlSchema("c:\inetpub\wwwroot\pdfwebcreator\personXSD.xsd")
dsPerson.ReadXml("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml")
Dim rptPerson As person
rptPerson = New person
rptPerson.SetDataSource(dsPerson)
crvPerson.ReportSource = rptPerson
crvPerson.DataBind()
rptPerson.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
rptPerson.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
rptPerson.ExportToDisk(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat, "c:\inetpub\wwwroot\pdfwebcreator\test2.pdf")
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
System.IO.File.Delete(Fname);
End Sub
But, though I've played around with several posibilities in code I still end up with the same error:
Stack Trace:
[LogOnException: Logon failed.]
.F(String , EngineExceptionErrorID
)
.A(Int16 , Int32 )
.@(Int16 )
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext)
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext)
CrystalDecisions.Web.ReportAgent.u(Boolean N)
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()
Where in my code should I even have to do a logon, using an XML file, an XSD schema. I even tried, suggested somewhere else, to set userid in the viewer - LogonInfo..... - to "Admin" but nothing seems to work.
Please help a desperate man
/Rickard
I have a problem driving me *%/#&"% crazy. Using VS.NET 2003 (CR integrated), Win 2000 Server, IIS, I'm just developing a simple web app testing the possibility to export web forms to pdf - through CR.
WebForm1 gathers simple data from user, the user makes, through a click, a submit to reportView.aspx where, in page_load sub, the following code lies:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xmlStr As String
xmlStr = "<persons xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='C:\inetpub\wwwroot\pdfWebCreator\personXSD.xsd'>"
xmlStr += "<person>"
xmlStr += "<firstname>"
xmlStr += Session.Item("firstName")
xmlStr += "</firstName>"
xmlStr += "<secondname>"
xmlStr += Session.Item("secondname")
xmlStr += "</secondname>"
xmlStr += "<phonenr>"
xmlStr += Session.Item("phonenr")
xmlStr += "</phonenr>"
xmlStr += "<personid>"
xmlStr += Session.Item("personid")
xmlStr += "</personid>"
xmlStr += "</person>"
xmlStr += "</persons>"
If Session.Item("xmlStr") Is Nothing Then
Session.Add("xmlStr", xmlStr)
Else
Session.Item("xmlStr") = xmlStr
End If
If IO.File.Exists("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml") = False Then
Dim sw As IO.StreamWriter = IO.File.CreateText("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml")
sw.WriteLine(xmlStr)
sw.Flush()
sw.Close()
sw = Nothing
Else
IO.File.Delete("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml")
Dim sw As IO.StreamWriter = IO.File.CreateText("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml")
sw.WriteLine(xmlStr)
sw.Flush()
sw.Close()
End If
Dim Fname As String = "c:\inetpub\wwwroot\pdfwebcreator\test.pdf"
' dsPerson is a dataset created at design time
dsPerson.ReadXmlSchema("c:\inetpub\wwwroot\pdfwebcreator\personXSD.xsd")
dsPerson.ReadXml("c:\inetpub\wwwroot\pdfwebcreator\webPerson.xml")
Dim rptPerson As person
rptPerson = New person
rptPerson.SetDataSource(dsPerson)
crvPerson.ReportSource = rptPerson
crvPerson.DataBind()
rptPerson.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
rptPerson.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
rptPerson.ExportToDisk(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat, "c:\inetpub\wwwroot\pdfwebcreator\test2.pdf")
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
System.IO.File.Delete(Fname);
End Sub
But, though I've played around with several posibilities in code I still end up with the same error:
Stack Trace:
[LogOnException: Logon failed.]
.F(String , EngineExceptionErrorID
)
.A(Int16 , Int32 )
.@(Int16 )
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext)
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext)
CrystalDecisions.Web.ReportAgent.u(Boolean N)
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()
Where in my code should I even have to do a logon, using an XML file, an XSD schema. I even tried, suggested somewhere else, to set userid in the viewer - LogonInfo..... - to "Admin" but nothing seems to work.
Please help a desperate man
/Rickard