Hi,
I have a strange problem, when I specify a DownloadName that contains '_' character it gets stripped out when the excel document has been generated and presented for download. Also the character length is limited.
exp1.DownloadName = "Control_Acceso_Denegado_" & String.Format("{0:yyyyMMddHHmmss}", DateTime.Now) & ".xls"
The following DownloadName returns: ControlAccesoDenegado20091113.XLS
Is this a bug?
Thanks Derek, It helped anr resolved my issue.
Regards
Mynk
Great, that did the job. Thanks.
Since this filename appears in the HTTP headers sent to the client, it was designed in such a way as to be Secure by Default if the download name is something user- or third party-supplied. It enforces constraints on the DownloadName and WorksheetName properties that are very restrictive.
What you can do is implement your own name validation, using the NameValidating event on the exporter control. See NameValidatingEventArgs for an overview.
In the most trivial case when you know the filename you are giving the Excel workbook is safe, the following event handler sidesteps this validation. It approves whatever name you have assigned to DownloadName,
void ExcelExporter1_NameValidating( object sender, NameValidatingEventArgs args){ args.ApprovedName = args.ProprosedName;}