CR .Net 2005& Web应用程序& Windows身份验证 [英] CR .Net 2005 & Web Application & Windows Authentication
问题描述
我有一个通过Windows身份验证模仿用户的Web应用程序。尝试生成报告会导致以下异常作为ReportDocument.Load()方法:
~~~~~~~~~~
S ystem.Runtime.InteropServices。 COMException(0x80000220):文件错误
C:\ WINDOWS \ TEMP \ rWorkorders {ED44F7CA-D4EC-4892-9645-D26AADE1FD9F} .rpt:访问
报告文件被拒绝。另一个程序可能正在使用它。
at
CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object&
DocumentPath,Int32 Options)
at
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper。 Open(Object&
DocumentPath,Int32 Options)
at
CrystalDecis ions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
~~~~~~~~~~ >
有没有人有解决方案,还是有其他方式我应该接近这个?下面是我当前的代码,thx。
##路径和Ds已经过实例化并在此之前设置了''#### ############################################# Dim Rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Rpt.Load(Server.MapPath("〜/ reports / rpt / rWorkorders.rpt"))
Rpt.SetDataSource(Ds)
Rpt.ExportToDisk(CrystalDecisions。 Shared.ExportFormatType.PortableDocFormat,Path)
Rpt.Close()
Dim Bt()As Byte
如果System.IO.File.Exists(Path)那么
Dim Strm As New System.IO.BinaryReader(System.IO.File.OpenRead(Path))
ReDim Bt(Strm.BaseStream.Length)
Bt = Strm.ReadBytes(Strm.BaseStream.Length)
Strm.Close ()
System.IO.File.Delete(Path)
End If
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType =" application / pdf"
Response.AddHeader(" Content-Disposition"," inline; filename = Workorders.pdf")
Response.BinaryWrite(Bt)
R esponse.End()
~~~~~~~~~~
I have a web application which impersonates users via windows authentication. Attempts to generate the report cause the following exception as the ReportDocument.Load() method:
~~~~~~~~~~
System.Runtime.InteropServices.COMException (0x80000220): Error in File
C:\WINDOWS\TEMP\rWorkorders {ED44F7CA-D4EC-4892-9645-D26AADE1FD9F}.rpt: Access
to report file denied. Another program may be using it.
at
CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object&
DocumentPath, Int32 Options)
at
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object&
DocumentPath, Int32 Options)
at
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
~~~~~~~~~~
Does anybody have a solution to this or is there another way I should be approaching this? Below is my current code, thx.
~~~~~~~~~~
'## Path and Ds have been instatiated and set prior to this point
'###############################################
Dim Rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Rpt.Load(Server.MapPath("~/reports/rpt/rWorkorders.rpt"))
Rpt.SetDataSource(Ds)
Rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Path)
Rpt.Close()
Dim Bt() As Byte
If System.IO.File.Exists(Path) Then
Dim Strm As New System.IO.BinaryReader(System.IO.File.OpenRead(Path))
ReDim Bt(Strm.BaseStream.Length)
Bt = Strm.ReadBytes(Strm.BaseStream.Length)
Strm.Close()
System.IO.File.Delete(Path)
End If
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition", "inline; filename=Workorders.pdf")
Response.BinaryWrite(Bt)
Response.End()
~~~~~~~~~~
推荐答案
任何人?
这篇关于CR .Net 2005& Web应用程序& Windows身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!