Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel to .Response
Message
From
16/05/2005 12:58:35
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Excel to .Response
Miscellaneous
Thread ID:
01014612
Message ID:
01014612
Views:
61
Hi,

I have the following code to return a Crystal report to the browser in XLS format:
oStream = oReport.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.Excel)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.BinaryWrite(oStream.ToArray())
Response.End()
oStream.Close()
The form containing this code requires Windows authentication (so at this point the browser is authenticated). Changing the above to use PDF format works fine but when returning the XLS version the user is prompted to authenticate again.

Oddly enough if the login screen is cancelled the XLS is received and displayed as expected .....

FWIW it's the .ExportToStream() type parameter that causes the problem - if I just change this to PDF the login prompt goes away (but of course the client falls over trying to load a PDF document as a speadsheet)

UPDATE: The XLS doesn't work when authentication is removed either - Excel fires up but the content is the rendered ASPX page. The ONLY way this works at the moment is with Authentication on and cancelling the browser login ???

Anyone know how to fix this ?
Regards,
Viv
Reply
Map
View

Click here to load this message in the networking platform